Changeset 3809 for branches/plugin/bbp-includes/bbp-user-functions.php
- Timestamp:
- 03/19/2012 05:25:49 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-includes/bbp-user-functions.php
r3758 r3809 530 530 */ 531 531 function bbp_get_topic_subscribers( $topic_id = 0 ) { 532 if ( empty( $topic_id ) ) 533 return; 532 if ( empty( $topic_id ) ) return; 534 533 535 534 global $wpdb; 536 535 537 // Get the users who have favorited the topic 538 $users = $wpdb->get_col( "SELECT user_id FROM {$wpdb->usermeta} WHERE meta_key = '_bbp_subscriptions' and FIND_IN_SET('{$topic_id}', meta_value) > 0" ); 539 $users = apply_filters( 'bbp_get_topic_subscribers', $users ); 540 541 if ( !empty( $users ) ) 536 $users = wp_cache_get( 'bbp_get_topic_subscribers_' . $topic_id, 'bbpress' ); 537 if ( empty( $users ) ) { 538 $users = $wpdb->get_col( "SELECT user_id FROM {$wpdb->usermeta} WHERE meta_key = '_bbp_subscriptions' and FIND_IN_SET('{$topic_id}', meta_value) > 0" ); 539 wp_cache_set( 'bbp_get_topic_subscribers_' . $topic_id, $users, 'bbpress' ); 540 } 541 542 if ( !empty( $users ) ) { 543 $users = apply_filters( 'bbp_get_topic_subscribers', $users ); 542 544 return $users; 545 } 543 546 544 547 return false; … … 676 679 $subscriptions = (string) implode( ',', $subscriptions ); 677 680 update_user_meta( $user_id, '_bbp_subscriptions', $subscriptions ); 681 682 wp_cache_delete( 'bbp_get_topic_subscribers_' . $topic_id, 'bbpress' ); 678 683 } 679 684 … … 718 723 delete_user_meta( $user_id, '_bbp_subscriptions' ); 719 724 } 725 726 wp_cache_delete( 'bbp_get_topic_subscribers_' . $topic_id, 'bbpress' ); 720 727 } 721 728
Note: See TracChangeset
for help on using the changeset viewer.