Changeset 6619 for trunk/src/includes/users/functions.php
- Timestamp:
- 07/09/2017 04:53:10 PM (8 years ago)
- File:
-
- 1 edited
-
trunk/src/includes/users/functions.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/users/functions.php
r6612 r6619 484 484 * 485 485 * @since 2.0.0 bbPress (r2660) 486 * 487 * @param int $user_id Optional. User id 488 * 489 * @return array|bool Results if the user has created topics, otherwise false 490 */ 491 function bbp_get_user_topics_started( $user_id = 0 ) { 492 493 // Validate user 494 $user_id = bbp_get_user_id( $user_id ); 495 if ( empty( $user_id ) ) { 496 return false; 497 } 498 499 // Try to get the topics 500 $query = bbp_has_topics( array( 501 'author' => $user_id 502 ) ); 486 * @since 2.6.0 bbPress (r6618) Signature changed to accept an array of arguments 487 * 488 * @param array $args Optional. Arguments to pass into bbp_has_topics() 489 * 490 * @return bool True if user has started topics, otherwise false 491 */ 492 function bbp_get_user_topics_started( $args = array() ) { 493 494 // Backwards compat for pre-2.6.0 495 if ( is_numeric( $args ) ) { 496 $args = array( 497 'author' => bbp_get_user_id( $args, false, false ) 498 ); 499 } 500 501 // Default arguments 502 $defaults = array( 503 'author' => bbp_get_displayed_user_id() 504 ); 505 506 // Parse arguments 507 $r = bbp_parse_args( $args, $defaults, 'get_user_topics_started' ); 508 509 // Get the topics 510 $query = bbp_has_topics( $r ); 511 $user_id = $r['author']; 503 512 504 513 // Filter & return 505 return apply_filters( 'bbp_get_user_topics_started', $query, $user_id );514 return apply_filters( 'bbp_get_user_topics_started', $query, $user_id, $r, $args ); 506 515 } 507 516 … … 510 519 * 511 520 * @since 2.2.0 bbPress (r4225) 512 * 513 * @param int $user_id Optional. User id 514 * 515 * @return array|bool Results if the user has created topics, otherwise false 516 */ 517 function bbp_get_user_replies_created( $user_id = 0 ) { 518 519 // Validate user 520 $user_id = bbp_get_user_id( $user_id ); 521 if ( empty( $user_id ) ) { 522 return false; 523 } 524 525 // Try to get the topics 526 $query = bbp_has_replies( array( 521 * @since 2.6.0 bbPress (r6618) Signature changed to accept an array of arguments 522 * 523 * @param array $args Optional. Arguments to pass into bbp_has_replies() 524 * 525 * @return bool True if user has created replies, otherwise false 526 */ 527 function bbp_get_user_replies_created( $args = array() ) { 528 529 // Backwards compat for pre-2.6.0 530 if ( is_numeric( $args ) ) { 531 $args = array( 532 'author' => bbp_get_user_id( $args, false, false ), 533 'post_type' => bbp_get_reply_post_type(), 534 'order' => 'DESC' 535 ); 536 } 537 538 // Default arguments 539 $defaults = array( 540 'author' => bbp_get_displayed_user_id(), 527 541 'post_type' => bbp_get_reply_post_type(), 528 'order' => 'DESC', 529 'author' => $user_id 530 ) ); 542 'order' => 'DESC' 543 ); 544 545 // Parse arguments 546 $r = bbp_parse_args( $args, $defaults, 'get_user_replies_created' ); 547 548 // Get the replies 549 $query = bbp_has_replies( $r ); 550 $user_id = $r['author']; 531 551 532 552 // Filter & return 533 return apply_filters( 'bbp_get_user_replies_created', $query, $user_id );553 return apply_filters( 'bbp_get_user_replies_created', $query, $user_id, $r, $args ); 534 554 } 535 555
Note: See TracChangeset
for help on using the changeset viewer.