Changeset 6218
- Timestamp:
- 01/12/2017 07:07:16 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/users/functions.php
r6216 r6218 288 288 * 289 289 * @param int $user_id Optional. User id 290 * @uses bbp_get_user_favorites_topic_ids() To get the user's favorites291 290 * @uses bbp_has_topics() To get the topics 292 291 * @uses apply_filters() Calls 'bbp_get_user_favorites' with the topic query and … … 295 294 */ 296 295 function bbp_get_user_favorites( $user_id = 0 ) { 297 $user_id = bbp_get_user_id( $user_id ); 298 $favorites = bbp_get_user_favorites_topic_ids( $user_id ); 299 $query = ! empty( $favorites ) 300 ? bbp_has_topics( array( 'post__in' => $favorites ) ) 301 : false; 302 303 return apply_filters( 'bbp_get_user_favorites', $query, $user_id, $favorites ); 296 $user_id = bbp_get_user_id( $user_id ); 297 $query = bbp_has_topics( array( 298 'meta_query' => array( 299 array( 300 'key' => '_bbp_favorite', 301 'value' => $user_id, 302 'compare' => 'NUMERIC' 303 ) 304 ) 305 ) ); 306 307 return apply_filters( 'bbp_get_user_favorites', $query, $user_id ); 304 308 } 305 309 … … 612 616 * 613 617 * @param int $user_id Optional. User id 614 * @uses bbp_get_user_subscribed_topic_ids() To get the user's subscriptions615 618 * @uses bbp_has_topics() To get the topics 616 619 * @uses apply_filters() Calls 'bbp_get_user_subscriptions' with the topic query … … 619 622 */ 620 623 function bbp_get_user_topic_subscriptions( $user_id = 0 ) { 621 622 // Default to the displayed user 623 $user_id = bbp_get_user_id( $user_id ); 624 $subscriptions = bbp_get_user_subscribed_topic_ids( $user_id ); 625 626 // If user has subscriptions, load them 627 if ( ! empty( $subscriptions ) ) { 628 $query = bbp_has_topics( array( 'post__in' => $subscriptions ) ); 629 } else { 630 $query = false; 631 } 624 $user_id = bbp_get_user_id( $user_id ); 625 $query = bbp_has_topics( array( 626 'meta_query' => array( 627 array( 628 'key' => '_bbp_subscription', 629 'value' => $user_id, 630 'compare' => 'NUMERIC' 631 ) 632 ) 633 ) ); 632 634 633 635 return apply_filters( 'bbp_get_user_topic_subscriptions', $query, $user_id ); … … 640 642 * 641 643 * @param int $user_id Optional. User id 642 * @uses bbp_get_user_subscribed_forum_ids() To get the user's subscriptions643 644 * @uses bbp_has_forums() To get the forums 644 645 * @uses apply_filters() Calls 'bbp_get_user_forum_subscriptions' with the forum … … 647 648 */ 648 649 function bbp_get_user_forum_subscriptions( $user_id = 0 ) { 649 650 // Default to the displayed user 651 $user_id = bbp_get_user_id( $user_id ); 652 $subscriptions = bbp_get_user_subscribed_forum_ids( $user_id ); 653 654 // If user has subscriptions, load them 655 if ( ! empty( $subscriptions ) ) { 656 $query = bbp_has_forums( array( 'post__in' => $subscriptions ) ); 657 } else { 658 $query = false; 659 } 650 $user_id = bbp_get_user_id( $user_id ); 651 $query = bbp_has_forums( array( 652 'meta_query' => array( 653 array( 654 'key' => '_bbp_subscription', 655 'value' => $user_id, 656 'compare' => 'NUMERIC' 657 ) 658 ) 659 ) ); 660 660 661 661 return apply_filters( 'bbp_get_user_forum_subscriptions', $query, $user_id );
Note: See TracChangeset
for help on using the changeset viewer.