Changeset 13105
- Timestamp:
- 09/11/2021 05:26:17 PM (3 years ago)
- Location:
- trunk/src
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-friends/bp-friends-functions.php
r13092 r13105 272 272 * @since 1.2.0 273 273 * 274 * @global object $friends_template274 * @global BP_Core_Members_Template $members_template 275 275 * 276 276 * @param int $user_id ID of the first user. -
trunk/src/bp-friends/bp-friends-template.php
r13092 r13105 244 244 * Return value is a string of the form "x friends". 245 245 * 246 * @global object$members_template246 * @global BP_Core_Members_Template $members_template 247 247 * 248 248 * @since 1.2.0 … … 538 538 * @since 1.2.0 539 539 * 540 * @global object$members_template540 * @global BP_Core_Members_Template $members_template 541 541 * 542 542 * @return int ID of the friendship. … … 573 573 * @since 1.0.0 574 574 * 575 * @global object$members_template575 * @global BP_Core_Members_Template $members_template 576 576 * 577 577 * @return string accept-friendship URL. … … 610 610 * @since 1.0.0 611 611 * 612 * @global object$members_template612 * @global BP_Core_Members_Template $members_template 613 613 * 614 614 * @return string reject-friendship URL. -
trunk/src/bp-friends/classes/class-bp-core-friends-widget.php
r13092 r13105 53 53 * @since 1.9.0 54 54 * 55 * @global object$members_template55 * @global BP_Core_Members_Template $members_template 56 56 * 57 57 * @param array $args Widget arguments. -
trunk/src/bp-members/bp-members-activity.php
r12926 r13105 15 15 * 16 16 * @since 2.2.0 17 *18 17 */ 19 18 function bp_members_register_activity_actions() { -
trunk/src/bp-members/bp-members-admin.php
r12824 r13105 55 55 * @param boolean $exists True if the member type already exists. False otherwise. 56 56 * @param string $type_id The member type identifier. 57 * @return bool eanTrue if the member type already exists. False otherwise.57 * @return bool True if the member type already exists. False otherwise. 58 58 */ 59 59 function bp_members_type_admin_type_exists( $exists = false, $type_id = '' ) { … … 71 71 * @since 7.0.0 72 72 * 73 * @param array 74 * @return array 73 * @param array $messages The feedback messages. 74 * @return array The feedback messages including the ones for the Member Types Admin actions. 75 75 */ 76 76 function bp_members_type_admin_updated_messages( $messages = array() ) { -
trunk/src/bp-members/bp-members-cache.php
r13098 r13105 18 18 * @param BP_User_Query $bp_user_query BP_User_Query object. 19 19 */ 20 function bp_members_prefetch_member_type( BP_User_Query$bp_user_query ) {20 function bp_members_prefetch_member_type( $bp_user_query ) { 21 21 $uncached_member_ids = bp_get_non_cached_ids( $bp_user_query->user_ids, 'bp_member_member_type' ); 22 22 -
trunk/src/bp-members/bp-members-cssjs.php
r13003 r13105 9 9 10 10 // Exit if accessed directly. 11 if ( ! defined( 'ABSPATH' ) ) { 12 exit; 13 } 11 defined( 'ABSPATH' ) || exit; 14 12 15 13 /** … … 23 21 function bp_members_register_scripts( $scripts = array() ) { 24 22 $scripts['bp-dynamic-members-script'] = array( 23 'footer' => true, 25 24 'file' => plugins_url( 'js/dynamic-members.js', __FILE__ ), 26 25 'dependencies' => array( … … 28 27 'wp-i18n', 29 28 ), 30 'footer' => true,31 29 ); 32 30 -
trunk/src/bp-members/bp-members-filters.php
r12945 r13105 16 16 * Escape commonly used fullname output functions. 17 17 */ 18 add_filter( 'bp_displayed_user_fullname', 18 add_filter( 'bp_displayed_user_fullname', 'esc_html' ); 19 19 add_filter( 'bp_get_loggedin_user_fullname', 'esc_html' ); 20 20 … … 135 135 * 136 136 * @param bool $retval Whether or not the current user has the capability. 137 * @param int $user_id 137 * @param int $user_id User ID. 138 138 * @param string $capability The capability being checked for. 139 139 * @param int $site_id Site ID. Defaults to the BP root blog. … … 327 327 * @param int|string $value The value for the requested property. 328 328 * @param string $property The name of the requested property. 329 * @param string $context The context of display.329 * @param string $context Optional. The context of display. 330 330 * @return int|string The sanitized value. 331 331 */ -
trunk/src/bp-members/bp-members-functions.php
r12935 r13105 23 23 $bp = buddypress(); 24 24 25 return (bool) ! empty( $bp->pages->members->id );25 return (bool) ! empty( $bp->pages->members->id ); 26 26 } 27 27 … … 38 38 * 39 39 * @since 1.5.0 40 * 41 * @global BuddyPress $bp The one true BuddyPress instance. 40 42 */ 41 43 function bp_core_define_slugs() { … … 207 209 // Don't use this filter. Subject to removal in a future release. 208 210 // Use the 'bp_core_get_user_domain' filter instead. 209 $domain 211 $domain = apply_filters( 'bp_core_get_user_domain_pre_cache', $domain, $user_id, $user_nicename, $user_login ); 210 212 211 213 /** … … 227 229 * @since 1.2.0 228 230 * 229 * @param 230 * @return array|bool Array of data on success, booleanfalse on failure.231 * @param int $user_id The ID of the user. 232 * @return array|bool Array of data on success, false on failure. 231 233 */ 232 234 function bp_core_get_core_userdata( $user_id = 0 ) { … … 235 237 } 236 238 237 // Get core user data 239 // Get core user data. 238 240 $userdata = BP_Core_User::get_core_userdata( $user_id ); 239 241 … … 243 245 * @since 1.2.0 244 246 * 245 * @param array|bool $userdata Array of user data for a passed user on success, booleanfalse on failure.247 * @param array|bool $userdata Array of user data for a passed user on success, false on failure. 246 248 */ 247 249 return apply_filters( 'bp_core_get_core_userdata', $userdata ); … … 285 287 * @param string $username User login to check. 286 288 */ 287 return apply_filters( 'bp_core_get_userid', ! empty( $user->ID ) ? $user->ID : NULL, $username );289 return apply_filters( 'bp_core_get_userid', ! empty( $user->ID ) ? $user->ID : null, $username ); 288 290 } 289 291 … … 311 313 * @param string $user_nicename User nicename to check. 312 314 */ 313 return apply_filters( 'bp_core_get_userid_from_nicename', ! empty( $user->ID ) ? $user->ID : NULL, $user_nicename );315 return apply_filters( 'bp_core_get_userid_from_nicename', ! empty( $user->ID ) ? $user->ID : null, $user_nicename ); 314 316 } 315 317 … … 362 364 */ 363 365 function bp_members_get_user_nicename( $user_id ) { 366 364 367 /** 365 368 * Filters the user_nicename based on originally provided user ID. … … 377 380 * @since 1.0.0 378 381 * 379 * @param int $u id User ID to check.382 * @param int $user_id User ID to check. 380 383 * @return string The email for the matched user. Empty string if no user 381 384 * matches the $user_id. 382 385 */ 383 386 function bp_core_get_user_email( $user_id ) { 387 384 388 /** 385 389 * Filters the user email for user based on user ID. … … 508 512 } 509 513 add_filter( 'bp_core_get_user_displayname', 'strip_tags', 1 ); 510 add_filter( 'bp_core_get_user_displayname', 'trim' 511 add_filter( 'bp_core_get_user_displayname', 'stripslashes' 512 add_filter( 'bp_core_get_user_displayname', 'esc_html' 514 add_filter( 'bp_core_get_user_displayname', 'trim' ); 515 add_filter( 'bp_core_get_user_displayname', 'stripslashes' ); 516 add_filter( 'bp_core_get_user_displayname', 'esc_html' ); 513 517 514 518 /** … … 569 573 * @since 1.2.0 570 574 * 575 * @global wpdb $wpdb WordPress database object. 576 * 571 577 * @return int The total number of members. 572 578 */ … … 596 602 * 597 603 * @since 1.6.0 604 * 605 * @global wpdb $wpdb WordPress database object. 598 606 * 599 607 * @return int The number of active members. … … 635 643 * @since 5.0.0 636 644 * 637 * @param int 638 * @param int 645 * @param int $user_id The user ID to spam or ham. 646 * @param int $value 0 to mark the user as `ham`, 1 to mark as `spam`. 639 647 * @return bool True if the spam status of the member changed. 640 648 * False otherwise. … … 677 685 * @since 1.6.0 678 686 * 687 * @global wpdb $wpdb WordPress database object. 688 * 679 689 * @param int $user_id The ID of the user being spammed/hammed. 680 690 * @param string $status 'spam' if being marked as spam, 'ham' otherwise. 681 * @param bool $do_wp_cleanup True to force the cleanup of WordPress content691 * @param bool $do_wp_cleanup Optional. True to force the cleanup of WordPress content 682 692 * and status, otherwise false. Generally, this should 683 693 * only be false if WordPress is expected to have … … 708 718 // Only you can prevent infinite loops. 709 719 remove_action( 'make_spam_user', 'bp_core_mark_user_spam_admin' ); 710 remove_action( 'make_ham_user', 'bp_core_mark_user_ham_admin' 720 remove_action( 'make_ham_user', 'bp_core_mark_user_ham_admin' ); 711 721 712 722 // Force the cleanup of WordPress content and status for multisite configs. … … 833 843 // Put things back how we found them. 834 844 add_action( 'make_spam_user', 'bp_core_mark_user_spam_admin' ); 835 add_action( 'make_ham_user', 'bp_core_mark_user_ham_admin');845 add_action( 'make_ham_user', 'bp_core_mark_user_ham_admin' ); 836 846 837 847 return true; … … 865 875 * 866 876 * @since 1.6.0 877 * 878 * @global BuddyPress $bp The one true BuddyPress instance. 867 879 * 868 880 * @param int $user_id The ID for the user. … … 937 949 * @since 1.6.0 938 950 * 951 * @global BuddyPress $bp The one true BuddyPress instance. 952 * 939 953 * @param int $user_id The ID for the user. 940 954 * @return bool True if deleted, otherwise false. … … 1003 1017 * @since 1.6.0 1004 1018 * 1005 * @param int $user_id The user ID to check.1019 * @param int $user_id Optional. The user ID to check. 1006 1020 * @return bool True if active, otherwise false. 1007 1021 */ … … 1037 1051 * @since 1.6.0 1038 1052 * 1039 * @todo No need for the user fallback checks, since they're done in 1040 * bp_is_user_active(). 1041 * 1042 * @param int $user_id The user ID to check. 1053 * @param int $user_id Optional. The user ID to check. 1043 1054 * @return bool True if inactive, otherwise false. 1044 1055 */ 1045 1056 function bp_is_user_inactive( $user_id = 0 ) { 1046 1047 // Default to current user.1048 if ( empty( $user_id ) && is_user_logged_in() ) {1049 $user_id = bp_loggedin_user_id();1050 }1051 1052 // No user to check.1053 if ( empty( $user_id ) ) {1054 return false;1055 }1056 1057 1057 // Return the inverse of active. 1058 return ! bp_is_user_active( $user_id );1058 return ! bp_is_user_active( $user_id ); 1059 1059 } 1060 1060 … … 1066 1066 * legacy user query is enabled. 1067 1067 * 1068 * @param int $user_id ID of the user being updated.1069 * @param string $time Time of last activity, in 'Y-m-d H:i:s' format.1068 * @param int $user_id Optional. ID of the user being updated. 1069 * @param string $time Optional. Time of last activity, in 'Y-m-d H:i:s' format. 1070 1070 * @return bool True on success, false on failure. 1071 1071 */ … … 1211 1211 * @since 2.0.0 1212 1212 * 1213 * @global BuddyPress $bp The one true BuddyPress instance. 1214 * @global wpdb $wpdb WordPress database object. 1215 * 1213 1216 * @return bool 1214 1217 */ … … 1514 1517 * @since 1.2.7 1515 1518 * 1516 * @param array|string $value Illegal names as being saved defined in 1517 * Multisite settings. 1518 * @param array|string $oldvalue The old value of the option. 1519 * @param array|string $value Illegal names as being saved defined in 1520 * Multisite settings. 1519 1521 * @return array Merged and unique array of illegal names. 1520 1522 */ 1521 function bp_core_get_illegal_names( $value = '' , $oldvalue = '') {1523 function bp_core_get_illegal_names( $value = '' ) { 1522 1524 1523 1525 // Make sure $value is array. … … 1545 1547 'notifications', 1546 1548 'register', 1547 'activate' 1549 'activate', 1548 1550 ); 1549 1551 … … 1563 1565 'BP_ACTIVATION_SLUG', 1564 1566 ); 1565 foreach ( $slug_constants as $constant ) {1567 foreach ( $slug_constants as $constant ) { 1566 1568 if ( defined( $constant ) ) { 1567 1569 $bp_component_slugs[] = constant( $constant ); … … 1588 1590 1589 1591 // First merge BuddyPress illegal names. 1590 $bp_merged_names 1592 $bp_merged_names = array_merge( (array) $filtered_illegal_names, (array) $db_illegal_names ); 1591 1593 1592 1594 // Then merge WordPress and BuddyPress illegal names. 1593 $merged_names 1595 $merged_names = array_merge( (array) $wp_filtered_illegal_names, (array) $bp_merged_names ); 1594 1596 1595 1597 // Remove duplicates. 1596 $illegal_names 1598 $illegal_names = array_unique( (array) $merged_names ); 1597 1599 1598 1600 /** … … 1605 1607 return apply_filters( 'bp_core_illegal_names', $illegal_names ); 1606 1608 } 1607 add_filter( 'pre_update_site_option_illegal_names', 'bp_core_get_illegal_names' , 10, 2);1609 add_filter( 'pre_update_site_option_illegal_names', 'bp_core_get_illegal_names' ); 1608 1610 1609 1611 /** … … 1860 1862 * 1861 1863 * @since 1.2.0 1864 * 1865 * @global BuddyPress $bp The one true BuddyPress instance. 1862 1866 * 1863 1867 * @todo There appears to be a bug in the return value on success. … … 1995 1999 * @since 1.2.2 1996 2000 * 2001 * @global wpdb $wpdb WordPress database object. 2002 * 1997 2003 * @param string $key Activation key. 1998 2004 * @return int|bool User ID on success, false on failure. … … 2118 2124 $current_field = isset( $user['meta']["field_{$field_id}"] ) ? $user['meta']["field_{$field_id}"] : false; 2119 2125 2120 if ( ! empty( $current_field ) ) {2126 if ( ! empty( $current_field ) ) { 2121 2127 xprofile_set_field_data( $field_id, $user_id, $current_field ); 2122 2128 } … … 2200 2206 * 2201 2207 * @since 2.0.1 2208 * 2209 * @global wpdb $wpdb WordPress database object. 2202 2210 */ 2203 2211 function bp_members_migrate_signups() { … … 2315 2323 * @since 1.1.0 2316 2324 * 2325 * @global BuddyPress $bp The one true BuddyPress instance. 2326 * 2317 2327 * @return string|bool Directory path on success, false on failure. 2318 2328 */ … … 2344 2354 'basedir' => $newbdir, 2345 2355 'baseurl' => $newburl, 2346 'error' => false 2356 'error' => false, 2347 2357 ) ); 2348 2358 } … … 2622 2632 * @since 2.6.0 2623 2633 * 2634 * @global BuddyPress $bp The one true BuddyPress instance. 2635 * 2624 2636 * @return object The displayed user object, null otherwise. 2625 2637 */ … … 2652 2664 echo bp_get_member_type_tax_name(); 2653 2665 } 2654 2655 2666 /** 2656 2667 * Return the slug of the member type taxonomy. … … 2661 2672 */ 2662 2673 function bp_get_member_type_tax_name() { 2674 2663 2675 /** 2664 2676 * Filters the slug of the member type taxonomy. … … 2690 2702 'bp_get_member_type_tax_labels', 2691 2703 array( 2692 2693 // General labels 2704 // General labels. 2694 2705 'name' => _x( 'Member Types', 'Member type taxonomy name', 'buddypress' ), 2695 2706 'singular_name' => _x( 'Member Type', 'Member type taxonomy singular name', 'buddypress' ), … … 2806 2817 * @since 2.2.0 2807 2818 * 2819 * @global BuddyPress $bp The one true BuddyPress instance. 2820 * 2808 2821 * @param string $member_type Unique string identifier for the member type. 2809 2822 * @param array $args { … … 2911 2924 * 2912 2925 * @param string $member_type The name of the member type. 2913 * @return object A member type object.2926 * @return object|null A member type object or null if it doesn't exist. 2914 2927 */ 2915 2928 function bp_get_member_type_object( $member_type ) { … … 2927 2940 * 2928 2941 * @since 2.2.0 2942 * 2943 * @global BuddyPress $bp The one true BuddyPress instance. 2929 2944 * 2930 2945 * @see bp_register_member_type() for accepted arguments. … … 2940 2955 */ 2941 2956 function bp_get_member_types( $args = array(), $output = 'names', $operator = 'and' ) { 2942 $types = buddypress()->members->types; 2957 $bp = buddypress(); 2958 $types = $bp->members->types; 2943 2959 2944 2960 // Merge with types available into the database. … … 3052 3068 * @param bool $append Optional. True to append this to existing types for user, 3053 3069 * false to replace. Default: false. 3054 * @return false|array $retval See {@see bp_set_object_terms()}.3070 * @return bool|array $retval See {@see bp_set_object_terms()}. 3055 3071 */ 3056 3072 function bp_set_member_type( $user_id, $member_type, $append = false ) { … … 3150 3166 3151 3167 if ( ! is_wp_error( $raw_types ) ) { 3152 $types = 3168 $types = array(); 3153 3169 3154 3170 // Only include currently registered group types. … … 3183 3199 * @since 2.2.0 3184 3200 * 3185 * @param string|array|bool $type asingle member type (if $single is true) or an array of member types3201 * @param string|array|bool $type A single member type (if $single is true) or an array of member types 3186 3202 * (if $single is false) or false on failure. 3187 3203 * @param int $user_id ID of the user. … … 3213 3229 } 3214 3230 3215 return in_array( $member_type, $types );3231 return in_array( $member_type, $types, true ); 3216 3232 } 3217 3233 … … 3222 3238 * 3223 3239 * @param int $user_id ID of the user. 3224 * @return false|array $value See {@see bp_set_member_type()}.3240 * @return bool|array $value See {@see bp_set_member_type()}. 3225 3241 */ 3226 3242 function bp_remove_member_type_on_user_delete( $user_id ) { … … 3250 3266 * @since 2.3.0 3251 3267 * 3268 * @global BuddyPress $bp The one true BuddyPress instance. 3269 * 3252 3270 * @return string 3253 3271 */ 3254 3272 function bp_get_current_member_type() { 3273 $bp = buddypress(); 3255 3274 3256 3275 /** … … 3261 3280 * @param string $value "Current" member type. 3262 3281 */ 3263 return apply_filters( 'bp_get_current_member_type', buddypress()->current_member_type );3282 return apply_filters( 'bp_get_current_member_type', $bp->current_member_type ); 3264 3283 } 3265 3284 … … 3285 3304 } 3286 3305 3287 $path = bp_core_avatar_upload_path() . '/' . $directory . '/' . $user_id;3306 $path = bp_core_avatar_upload_path() . '/' . $directory . '/' . $user_id; 3288 3307 $newbdir = $path; 3289 $newurl = bp_core_avatar_url() . '/' . $directory . '/' . $user_id;3308 $newurl = bp_core_avatar_url() . '/' . $directory . '/' . $user_id; 3290 3309 $newburl = $newurl; 3291 $newsubdir = '/' . $directory . '/' . $user_id;3310 $newsubdir = '/' . $directory . '/' . $user_id; 3292 3311 3293 3312 /** … … 3304 3323 'basedir' => $newbdir, 3305 3324 'baseurl' => $newburl, 3306 'error' => false 3325 'error' => false, 3307 3326 ) ); 3308 3327 } … … 3313 3332 * @since 8.0.0 3314 3333 * 3315 * @param int $user_id The new user's ID 3334 * @param int $user_id The new user's ID. 3316 3335 */ 3317 3336 function bp_send_welcome_email( $user_id = 0 ) { … … 3349 3368 * @since 8.0.0 3350 3369 * 3351 * @param array $args Invitation arguments. 3352 * See BP_Invitation::get() for list. 3353 * 3354 * @return array $invites Matching BP_Invitation objects. 3370 * @param array $args Invitation arguments. See BP_Invitation::get() for list. 3371 * @return array $invites Matching BP_Invitation objects. 3355 3372 */ 3356 3373 function bp_members_invitations_get_invites( $args = array() ) { … … 3411 3428 'date_modified' => bp_core_current_time(), 3412 3429 'content' => '', 3413 'send_invite' => 0 3430 'send_invite' => 0, 3414 3431 ), 3415 3432 'members_invitations_invite_user' … … 3422 3439 'date_modified' => $r['date_modified'], 3423 3440 'content' => $r['content'], 3424 'send_invite' => $r['send_invite'] 3441 'send_invite' => $r['send_invite'], 3425 3442 ); 3426 3443 … … 3550 3567 'inviter_id' => null, 3551 3568 'accepted' => null, 3552 'invite_sent' => null 3569 'invite_sent' => null, 3553 3570 ), 3554 3571 'members_invitations_delete_invites' … … 3561 3578 'inviter_id' => $r['inviter_id'], 3562 3579 'accepted' => $r['accepted'], 3563 'invite_sent' => $r['invite_sent'] 3580 'invite_sent' => $r['invite_sent'], 3564 3581 ); 3565 3582 … … 3585 3602 * @since 8.0.0 3586 3603 * 3587 * @param BP_Invitation object$invitation Invitation to create hash from.3604 * @param BP_Invitation $invitation Invitation to create hash from. 3588 3605 * 3589 3606 * @return string $hash Calculated sha1 hash. 3590 3607 */ 3591 function bp_members_invitations_get_hash( BP_Invitation$invitation ) {3608 function bp_members_invitations_get_hash( $invitation ) { 3592 3609 $hash = false; 3593 3610 … … 3613 3630 * @since 8.0.0 3614 3631 * 3615 * @param string $hashCalculated sha1 hash.3616 * @param BP_Invitation object$invitation Invitation hash was created from.3632 * @param string $hash Calculated sha1 hash. 3633 * @param BP_Invitation $invitation Invitation hash was created from. 3617 3634 */ 3618 3635 return apply_filters( 'bp_members_invitations_get_hash', $hash, $invitation ); -
trunk/src/bp-members/bp-members-invitations.php
r12961 r13105 70 70 * @since 8.0.0 71 71 * 72 * @param bool $send Whether or not to send the activation key. 73 * @param int $user_id User ID to send activation key to. 74 * @param string $user_email User email to send activation key to. 75 * @param string $activation_key Activation key to be sent. 76 * @param array $usermeta Miscellaneous metadata about the user (blog-specific 77 * signup data, xprofile data, etc). 72 * @param bool $send Whether or not to send the activation key. 73 * @param int $user_id User ID to send activation key to. 74 * @param string $user_email User email to send activation key to. 75 * 78 76 * @return bool Whether or not to send the activation key. 79 77 */ 80 function bp_members_invitations_cancel_activation_email( $send, $user_id = 0, $user_email = '' , $activation_key = '', $usermeta = array()) {78 function bp_members_invitations_cancel_activation_email( $send, $user_id = 0, $user_email = '' ) { 81 79 $invite = bp_members_invitations_get_invites( 82 80 array( 83 81 'invitee_email' => $user_email, 84 'invite_sent' => 'sent' 82 'invite_sent' => 'sent', 85 83 ) 86 84 ); … … 92 90 return $send; 93 91 } 94 add_filter( 'bp_core_signup_send_activation_key', 'bp_members_invitations_cancel_activation_email', 10, 5);92 add_filter( 'bp_core_signup_send_activation_key', 'bp_members_invitations_cancel_activation_email', 10, 3 ); 95 93 96 94 /** … … 101 99 * @since 8.0.0 102 100 * 103 * @param bool|WP_Error $user_id True on success, WP_Error on failure. 104 * @param string $user_login Login name requested by the user. 105 * @param string $user_password Password requested by the user. 106 * @param string $user_email Email address requested by the user. 101 * @global BuddyPress $bp The one true BuddyPress instance. 102 * 103 * @param bool|WP_Error $user_id True on success, WP_Error on failure. 107 104 */ 108 function bp_members_invitations_complete_signup( $user_id, $user_login = '', $user_password = '', $user_email = '' ) { 105 function bp_members_invitations_complete_signup( $user_id ) { 106 $bp = buddypress(); 107 109 108 if ( ! $user_id ) { 110 109 return; … … 147 146 } 148 147 } 149 add_action( 'bp_core_signup_user', 'bp_members_invitations_complete_signup' , 10, 4);148 add_action( 'bp_core_signup_user', 'bp_members_invitations_complete_signup' ); 150 149 151 150 /** … … 157 156 */ 158 157 function bp_members_invitations_delete_optedout_invites( $optout ) { 159 160 $args = array( 161 'invitee_email' => $optout->email_address, 158 bp_members_invitations_delete_invites( 159 array( 160 'invitee_email' => $optout->email_address, 161 ) 162 162 ); 163 bp_members_invitations_delete_invites( $args );164 163 } 165 164 add_action( 'bp_optout_after_save', 'bp_members_invitations_delete_optedout_invites' ); -
trunk/src/bp-members/bp-members-loader.php
r11360 r13105 4 4 * 5 5 * @package BuddyPress 6 * @subpackage Members 6 * @subpackage MembersLoader 7 7 * @since 1.5.0 8 8 */ -
trunk/src/bp-members/bp-members-notifications.php
r12933 r13105 129 129 return; 130 130 } 131 foreach ( $invites as $invite) { 131 132 foreach ( $invites as $invite ) { 132 133 // Include the id of the "accepted" invitation. 133 134 if ( $invite->inviter_id === $inviter_id ) { … … 137 138 $secondary_item_id = 0; 138 139 } 139 $res = bp_notifications_add_notification( array( 140 141 bp_notifications_add_notification( array( 140 142 'user_id' => $invite->inviter_id, 141 143 'item_id' => $new_user->ID, … … 153 155 * Mark accepted invitation notifications as read when user visits new user profile. 154 156 * 155 *156 157 * @since 8.0.0 157 158 */ … … 164 165 BP_Notifications_Notification::update( 165 166 array( 166 'is_new' => false167 'is_new' => false, 167 168 ), 168 169 array( … … 226 227 </tbody> 227 228 </table> 228 229 229 <?php 230 230 } -
trunk/src/bp-members/bp-members-template.php
r12951 r13105 6 6 * 7 7 * @package BuddyPress 8 * @subpackage Members 8 * @subpackage MembersTemplate 9 9 * @since 1.5.0 10 10 */ … … 17 17 * 18 18 * @since 2.4.0 19 *20 19 */ 21 20 function bp_profile_slug() { … … 45 44 * 46 45 * @since 1.5.0 47 *48 46 */ 49 47 function bp_members_slug() { … … 73 71 * 74 72 * @since 1.5.0 75 *76 73 */ 77 74 function bp_members_root_slug() { … … 92 89 * @since 1.5.0 93 90 * 94 * @param string $ slug Members component root slug.91 * @param string $root_slug Members component root slug. 95 92 */ 96 93 return apply_filters( 'bp_get_members_root_slug', buddypress()->members->root_slug ); … … 106 103 } 107 104 /** 108 * Get the member type base slug.105 * Get the member type URL base. 109 106 * 110 107 * The base slug is the string used as the base prefix when generating member type directory URLs. … … 117 114 */ 118 115 function bp_get_members_member_type_base() { 116 119 117 /** 120 118 * Filters the member type URL base. … … 122 120 * @since 2.3.0 123 121 * 124 * @param string $base 122 * @param string $base Base slug for the member type. 125 123 */ 126 124 return apply_filters( 'bp_members_member_type_base', _x( 'type', 'member type URL base', 'buddypress' ) ); … … 131 129 * 132 130 * @since 1.5.0 133 *134 131 */ 135 132 function bp_members_directory_permalink() { … … 160 157 * @since 2.5.0 161 158 * 162 * @param string $member_type Optional. Member type. 159 * @param string $member_type Optional. Member type. Defaults to current member type. 163 160 */ 164 161 function bp_member_type_directory_permalink( $member_type = '' ) { … … 205 202 * 206 203 * @since 1.5.0 207 *208 204 */ 209 205 function bp_signup_slug() { … … 215 211 * @since 1.5.0 216 212 * 213 * @global BuddyPress $bp The one true BuddyPress instance. 214 * 217 215 * @return string 218 216 */ … … 220 218 $bp = buddypress(); 221 219 222 if ( ! empty( $bp->pages->register->slug ) ) {220 if ( ! empty( $bp->pages->register->slug ) ) { 223 221 $slug = $bp->pages->register->slug; 224 222 } elseif ( defined( 'BP_REGISTER_SLUG' ) ) { … … 242 240 * 243 241 * @since 1.5.0 244 *245 242 */ 246 243 function bp_activate_slug() { … … 252 249 * @since 1.5.0 253 250 * 251 * @global BuddyPress $bp The one true BuddyPress instance. 252 * 254 253 * @return string 255 254 */ … … 257 256 $bp = buddypress(); 258 257 259 if ( ! empty( $bp->pages->activate->slug ) ) {258 if ( ! empty( $bp->pages->activate->slug ) ) { 260 259 $slug = $bp->pages->activate->slug; 261 260 } elseif ( defined( 'BP_ACTIVATION_SLUG' ) ) { … … 279 278 * 280 279 * @since 8.0.0 281 *282 280 */ 283 281 function bp_members_invitations_slug() { … … 313 311 * @since 7.0.0 Added `xprofile_query` parameter. Added `user_ids` parameter. 314 312 * 315 * @global object $members_template {@link BP_Members_Template}313 * @global BP_Core_Members_Template $members_template 316 314 * 317 315 * @param array|string $args { … … 440 438 * @since 2.6.0 Added the `$r` parameter 441 439 * 442 * @param bool $value Whether or not there are members to iterate over.443 * @param array$members_template Populated $members_template global.444 * @param array $r Array of arguments passed into the BP_Core_Members_Template class.440 * @param bool $value Whether or not there are members to iterate over. 441 * @param BP_Core_Members_Template $members_template Populated $members_template global. 442 * @param array $r Array of arguments passed into the BP_Core_Members_Template class. 445 443 */ 446 444 return apply_filters( 'bp_has_members', $members_template->has_members(), $members_template, $r ); … … 451 449 * 452 450 * @since 1.2.0 451 * 452 * @global BP_Core_Members_Template $members_template 453 453 * 454 454 * @return object … … 464 464 * @since 1.2.0 465 465 * 466 * @global BP_Core_Members_Template $members_template 467 * 466 468 * @return bool 467 469 */ … … 484 486 * @since 1.5.0 485 487 * 488 * @global BP_Core_Members_Template $members_template 489 * 486 490 * @return string 487 491 */ … … 489 493 global $members_template; 490 494 491 if ( empty( $members_template->type ) ) 495 if ( empty( $members_template->type ) ) { 492 496 $members_template->type = ''; 497 } 493 498 494 499 $start_num = intval( ( $members_template->pag_page - 1 ) * $members_template->pag_num ) + 1; … … 550 555 * @since 1.2.0 551 556 * 557 * @global BP_Core_Members_Template $members_template 558 * 552 559 * @return string 553 560 */ … … 569 576 * 570 577 * @since 1.2.0 571 *572 578 */ 573 579 function bp_member_user_id() { … … 579 585 * @since 1.2.0 580 586 * 581 * @return string Member ID. 587 * @global BP_Core_Members_Template $members_template 588 * 589 * @return int Member ID. 582 590 */ 583 591 function bp_get_member_user_id() { 584 592 global $members_template; 585 $member_id = isset( $members_template->member->id ) ? (int) $members_template->member->id : false; 593 594 $member_id = isset( $members_template->member->id ) 595 ? (int) $members_template->member->id 596 : 0; 586 597 587 598 /** … … 592 603 * @param int $member_id ID of the member being iterated over. 593 604 */ 594 return apply_filters( 'bp_get_member_user_id', $member_id );605 return apply_filters( 'bp_get_member_user_id', (int) $member_id ); 595 606 } 596 607 … … 610 621 * @since 1.7.0 611 622 * 623 * @global BP_Core_Members_Template $members_template 624 * 612 625 * @param array $classes Array of custom classes. 626 * 613 627 * @return string Row class of the member 614 628 */ … … 679 693 * @since 1.2.5 680 694 * 695 * @global BP_Core_Members_Template $members_template 696 * 681 697 * @return string Members nicename. 682 698 */ … … 707 723 * @since 1.2.5 708 724 * 725 * @global BP_Core_Members_Template $members_template 726 * 709 727 * @return string Member's login. 710 728 */ … … 735 753 * @since 1.2.5 736 754 * 755 * @global BP_Core_Members_Template $members_template 756 * 737 757 * @return string Member's email address. 738 758 */ … … 754 774 * 755 775 * @since 1.2.5 776 * @since 10.0.0 Updated to get member ID from `bp_get_member_user_id`. 756 777 * 757 778 * @return bool 758 779 */ 759 780 function bp_member_is_loggedin_user() { 760 global $members_template;761 781 762 782 /** … … 767 787 * @param bool $value Whether current member in the loop is logged in. 768 788 */ 769 return apply_filters( 'bp_member_is_loggedin_user', bp_loggedin_user_id() == $members_template->member->id ? true : false);789 return apply_filters( 'bp_member_is_loggedin_user', ( bp_loggedin_user_id() === bp_get_member_user_id() ) ); 770 790 } 771 791 … … 796 816 * 797 817 * @since 1.2.0 818 * 819 * @global BP_Core_Members_Template $members_template 798 820 * 799 821 * @see bp_core_fetch_avatar() For a description of arguments and … … 809 831 * @type int|bool $width Default: false. 810 832 * @type int|bool $height Default: false. 833 * @type bool $no_grav Default: false. 811 834 * @type bool $id Currently unused. 812 * @type bool $no_grav Default: false.813 835 * } 814 836 * @return string User avatar string. … … 817 839 global $members_template; 818 840 819 $fullname = !empty( $members_template->member->fullname ) ? $members_template->member->fullname : $members_template->member->display_name; 820 821 $defaults = array( 822 'type' => 'thumb', 823 'width' => false, 824 'height' => false, 825 'class' => 'avatar', 826 'id' => false, 827 'alt' => sprintf( __( 'Profile picture of %s', 'buddypress' ), $fullname ) 841 $fullname = ! empty( $members_template->member->fullname ) 842 ? $members_template->member->fullname 843 : $members_template->member->display_name; 844 845 $r = wp_parse_args( 846 $args, 847 array( 848 'type' => 'thumb', 849 'width' => false, 850 'height' => false, 851 'class' => 'avatar', 852 'id' => false, 853 'no_grav' => false, 854 // translators: %s is the full name of the user. 855 'alt' => sprintf( __( 'Profile picture of %s', 'buddypress' ), $fullname ), 856 ) 828 857 ); 829 858 830 $r = wp_parse_args( $args, $defaults ); 831 extract( $r, EXTR_SKIP ); 832 833 /** 834 * Filters a members avatar. 859 $avatar = bp_core_fetch_avatar( 860 array( 861 'email' => bp_get_member_user_email(), 862 'item_id' => bp_get_member_user_id(), 863 'type' => $r['type'], 864 'alt' => $r['alt'], 865 'no_grav' => $r['no_grav'], 866 'css_id' => $r['id'], 867 'class' => $r['class'], 868 'width' => $r['width'], 869 'height' => $r['height'], 870 ) 871 ); 872 873 /** 874 * Filters a member's avatar. 835 875 * 836 876 * @since 1.2.0 … … 840 880 * @param array $r Array of parsed arguments. See {@link bp_get_member_avatar()}. 841 881 */ 842 return apply_filters( 'bp_get_member_avatar', bp_core_fetch_avatar( array( 'item_id' => $members_template->member->id, 'type' => $type, 'alt' => $alt, 'css_id' => $id, 'class' => $class, 'width' => $width, 'height' => $height, 'email' => $members_template->member->user_email ) ), $r );882 return apply_filters( 'bp_get_member_avatar', $avatar, $r ); 843 883 } 844 884 … … 856 896 * @since 1.2.0 857 897 * 898 * @global BP_Core_Members_Template $members_template 899 * 858 900 * @return string 859 901 */ … … 876 918 * @since 1.2.0 877 919 */ 878 function bp_member_link() { echo esc_url( bp_get_member_permalink() ); } 920 function bp_member_link() { 921 echo esc_url( bp_get_member_permalink() ); 922 } 879 923 880 924 /** … … 883 927 * @since 1.2.0 884 928 */ 885 function bp_get_member_link() { return bp_get_member_permalink(); } 929 function bp_get_member_link() { 930 return bp_get_member_permalink(); 931 } 886 932 887 933 /** … … 910 956 * 911 957 * @since 1.2.0 958 * 959 * @global BP_Core_Members_Template $members_template 912 960 * 913 961 * @return string The user's fullname for display. … … 964 1012 * @since 2.7.0 Added 'relative' as a parameter to $args. 965 1013 * 1014 * @global BP_Core_Members_Template $members_template 1015 * 966 1016 * @param array $args { 967 1017 * Array of optional arguments. … … 1032 1082 * @since 1.2.0 1033 1083 * 1084 * @global BP_Core_Members_Template $members_template 1085 * 1034 1086 * @param array|string $args { 1035 1087 * Array of optional arguments. … … 1108 1160 * 1109 1161 * @since 1.2.0 1162 * 1163 * @global BP_Core_Members_Template $members_template 1110 1164 * 1111 1165 * @param array|string $args { … … 1198 1252 * @since 2.7.0 Added $args as a parameter. 1199 1253 * 1200 * @param array $args Optional. {@see bp_get_member_registered()} 1254 * @param array $args Optional. {@see bp_get_member_registered()}. 1201 1255 */ 1202 1256 function bp_member_registered( $args = array() ) { … … 1207 1261 * 1208 1262 * @since 1.2.0 1209 * @since 2.7.0 Added $args as a parameter. 1263 * @since 2.7.0 Added `$args` as a parameter. 1264 * 1265 * @global BP_Core_Members_Template $members_template 1210 1266 * 1211 1267 * @param array $args { 1212 1268 * Array of optional parameters. 1213 *1214 1269 * @type bool $relative Optional. If true, returns relative registered date. eg. registered 5 months ago. 1215 1270 * If false, returns registered date value from database. 1216 1271 * } 1217 *1218 1272 * @return string 1219 1273 */ … … 1240 1294 * 1241 1295 * @param string $registered The 'registered [x days ago]' string. 1242 */ 1243 return apply_filters( 'bp_member_registered', $registered ); 1296 * @param array $r Array of parsed arguments. 1297 */ 1298 return apply_filters( 'bp_member_registered', $registered, $r ); 1244 1299 } 1245 1300 … … 1248 1303 * 1249 1304 * @since 1.2.0 1305 * @since 10.0.0 Updated to get member ID using `bp_get_member_user_id`. 1250 1306 */ 1251 1307 function bp_member_random_profile_data() { 1252 global $members_template;1253 1254 1308 if ( bp_is_active( 'xprofile' ) ) { ?> 1255 <?php $random_data = xprofile_get_random_profile_data( $members_template->member->id, true ); ?>1309 <?php $random_data = xprofile_get_random_profile_data( bp_get_member_user_id(), true ); ?> 1256 1310 <strong><?php echo wp_filter_kses( $random_data[0]->name ) ?></strong> 1257 1311 <?php echo wp_filter_kses( $random_data[0]->value ) ?> … … 1323 1377 * @since 1.2.0 1324 1378 * 1325 * @return int1379 * @return string 1326 1380 */ 1327 1381 function bp_get_total_site_member_count() { … … 1352 1406 * 1353 1407 * @since 1.1.0 1408 * 1409 * @global BuddyPress $bp The one true BuddyPress instance. 1354 1410 * 1355 1411 * @todo Move to a back-compat file? … … 1442 1498 } 1443 1499 1444 // Init the hierarchy 1500 // Init the hierarchy. 1445 1501 $template_names = array( 1446 1502 'members/single/front-id-' . (int) $displayed_user->id . '.php', … … 1460 1516 } 1461 1517 1462 $template_names[] = 'members/single/front-member-type-' . sanitize_file_name( $displayed_user_member_type ) 1463 } 1464 1465 // Add The generic template to the end of the hierarchy 1518 $template_names[] = 'members/single/front-member-type-' . sanitize_file_name( $displayed_user_member_type ) . '.php'; 1519 } 1520 1521 // Add The generic template to the end of the hierarchy. 1466 1522 $template_names[] = 'members/single/front.php'; 1467 1523 … … 1471 1527 * @since 2.6.0 1472 1528 * 1473 * @param array $template_names Array of template paths. 1474 */ 1475 return bp_locate_template( apply_filters( 'bp_displayed_user_get_front_template', $template_names ), false, true ); 1529 * @param array $template_names Array of template paths. 1530 */ 1531 $template_names = apply_filters( 'bp_displayed_user_get_front_template', $template_names ); 1532 1533 return bp_locate_template( $template_names, false, true ); 1476 1534 } 1477 1535 … … 1491 1549 * 1492 1550 * @since 1.1.0 1551 * 1552 * @global BuddyPress $bp The one true BuddyPress instance. 1493 1553 */ 1494 1554 function bp_get_displayed_user_nav() { … … 1665 1725 * @since 1.5.0 1666 1726 * 1727 * @global BuddyPress $bp The one true BuddyPress instance. 1728 * 1667 1729 * @return string 1668 1730 */ … … 1671 1733 1672 1734 // If displayed user exists, return email address. 1673 if ( isset( $bp->displayed_user->userdata->user_email ) ) 1735 if ( isset( $bp->displayed_user->userdata->user_email ) ) { 1674 1736 $retval = $bp->displayed_user->userdata->user_email; 1675 else1737 } else { 1676 1738 $retval = ''; 1739 } 1677 1740 1678 1741 /** … … 1696 1759 */ 1697 1760 function bp_last_activity( $user_id = 0 ) { 1698 1699 /** 1700 * Filters the 'active [x days ago]' string for a user. 1701 * 1702 * @since 1.0.0 1703 * 1704 * @param string $value Formatted 'active [x days ago]' string. 1705 */ 1706 echo apply_filters( 'bp_last_activity', bp_get_last_activity( $user_id ) ); 1761 echo bp_get_last_activity( $user_id ); 1707 1762 } 1708 1763 /** … … 1758 1813 1759 1814 // Try to get displayed user. 1760 if ( empty( $name ) ) 1815 if ( empty( $name ) ) { 1761 1816 $name = bp_get_displayed_user_fullname(); 1817 } 1762 1818 1763 1819 // Fall back on logged in user. 1764 if ( empty( $name ) ) 1820 if ( empty( $name ) ) { 1765 1821 $name = bp_get_loggedin_user_fullname(); 1822 } 1766 1823 1767 1824 $fullname = (array) explode( ' ', $name ); … … 1837 1894 * @deprecated 1838 1895 */ 1839 function bp_user_link() { bp_displayed_user_domain(); } 1896 function bp_user_link() { 1897 bp_displayed_user_domain(); 1898 } 1840 1899 1841 1900 /** … … 1844 1903 * @since 1.0.0 1845 1904 */ 1846 function bp_current_user_id() { return bp_displayed_user_id(); } 1905 function bp_current_user_id() { 1906 return bp_displayed_user_id(); 1907 } 1847 1908 1848 1909 /** … … 1850 1911 * 1851 1912 * @since 1.0.0 1913 * 1914 * @global BuddyPress $bp The one true BuddyPress instance. 1852 1915 * 1853 1916 * @return string … … 1871 1934 * @since 1.0.0 1872 1935 * 1936 * @global BuddyPress $bp The one true BuddyPress instance. 1937 * 1873 1938 * @return string 1874 1939 */ … … 1899 1964 * @since 1.2.0 1900 1965 * 1966 * @global BuddyPress $bp The one true BuddyPress instance. 1967 * 1901 1968 * @return string 1902 1969 */ … … 1935 2002 * @since 1.0.0 1936 2003 * 2004 * @global BuddyPress $bp The one true BuddyPress instance. 2005 * 1937 2006 * @return string 1938 2007 */ … … 1962 2031 * 1963 2032 * @since 1.2.0 2033 * 2034 * @global BuddyPress $bp The one true BuddyPress instance. 1964 2035 * 1965 2036 * @return string … … 1996 2067 * 1997 2068 * @since 1.2.0 2069 * 2070 * @global BuddyPress $bp The one true BuddyPress instance. 1998 2071 * 1999 2072 * @return string … … 2098 2171 * 2099 2172 * @since 7.0.0 2100 * @see bp_get_member_type_list() For additional information on default arguments. 2173 * 2174 * @see bp_get_member_type_list() For additional information on default arguments. 2101 2175 * 2102 2176 * @param int $user_id User ID. … … 2111 2185 * @since 7.0.0 2112 2186 * 2113 * @param int $user_id User ID. Defaults to displayed user ID if on a member page.2114 * @param array|string $r {2187 * @param int $user_id User ID. Defaults to displayed user ID if on a member page. 2188 * @param array|string $r { 2115 2189 * Array of parameters. All items are optional. 2116 2190 * @type string $parent_element Element to wrap around the list. Defaults to 'p'. … … 2245 2319 static $has_page = false; 2246 2320 2247 if ( empty( $has_page ) ) 2321 if ( empty( $has_page ) ) { 2248 2322 $has_page = bp_get_signup_slug() && bp_locate_template( array( 'registration/register.php', 'members/register.php', 'register.php' ), false ); 2323 } 2249 2324 2250 2325 return (bool) $has_page; … … 2506 2581 * @since 2.1.0 2507 2582 * 2583 * @global WP_Network $current_site 2584 * 2508 2585 * @return string The base URL - eg, 'example.com' for site_url() example.com or www.example.com. 2509 2586 */ … … 2602 2679 * @since 1.1.0 2603 2680 * 2681 * @global BuddyPress $bp The one true BuddyPress instance. 2682 * 2604 2683 * @return string 2605 2684 */ … … 2669 2748 * @since 1.1.0 2670 2749 * 2750 * @global BuddyPress $bp The one true BuddyPress instance. 2751 * 2671 2752 * @return string 2672 2753 */ … … 2691 2772 * 2692 2773 * @since 1.1.0 2774 * 2775 * @global BuddyPress $bp The one true BuddyPress instance. 2693 2776 * 2694 2777 * @see bp_core_fetch_avatar() for description of arguments. … … 2707 2790 2708 2791 $defaults = array( 2709 'size' => bp_core_avatar_full_width(),2792 'size' => bp_core_avatar_full_width(), 2710 2793 'class' => 'avatar', 2711 'alt' => __( 'Your Profile Photo', 'buddypress' )2794 'alt' => __( 'Your Profile Photo', 'buddypress' ), 2712 2795 ); 2713 2796 … … 2715 2798 extract( $r, EXTR_SKIP ); 2716 2799 2800 $signup_avatar_dir = bp_get_signup_avatar_dir_value(); 2801 2717 2802 // Avatar DIR is found. 2718 if ( $signup_avatar_dir = bp_get_signup_avatar_dir_value()) {2803 if ( $signup_avatar_dir ) { 2719 2804 $gravatar_img = bp_core_fetch_avatar( array( 2720 2805 'item_id' => $signup_avatar_dir, … … 2725 2810 'height' => $size, 2726 2811 'alt' => $alt, 2727 'class' => $class 2812 'class' => $class, 2728 2813 ) ); 2729 2814 … … 2732 2817 2733 2818 // Set default gravatar type. 2734 if ( empty( $bp->grav_default->user ) ) 2819 if ( empty( $bp->grav_default->user ) ) { 2735 2820 $default_grav = 'wavatar'; 2736 elseif ( 'mystery' == $bp->grav_default->user )2821 } elseif ( 'mystery' === $bp->grav_default->user ) { 2737 2822 $default_grav = $bp->plugin_url . 'bp-core/images/mystery-man.jpg'; 2738 else2823 } else { 2739 2824 $default_grav = $bp->grav_default->user; 2825 } 2740 2826 2741 2827 /** … … 2780 2866 */ 2781 2867 function bp_get_signup_allowed() { 2868 2782 2869 /** 2783 2870 * Filters whether or not new signups are allowed. … … 2902 2989 echo bp_get_avatar_delete_link(); 2903 2990 } 2904 2905 2991 /** 2906 2992 * Return an avatar delete link. … … 2934 3020 * 2935 3021 * @since 8.0.0 3022 * 3023 * @global BuddyPress $bp The one true BuddyPress instance. 2936 3024 * 2937 3025 * @param array|string $args { … … 3008 3096 * @since 8.0.0 3009 3097 * 3098 * @global BuddyPress $bp The one true BuddyPress instance. 3099 * 3010 3100 * @return array List of network invitations. 3011 3101 */ … … 3019 3109 * @since 8.0.0 3020 3110 * 3111 * @global BuddyPress $bp The one true BuddyPress instance. 3112 * 3021 3113 * @return object The current network invitation within the loop. 3022 3114 */ … … 3038 3130 * @since 8.0.0 3039 3131 * 3132 * @global BuddyPress $bp The one true BuddyPress instance. 3133 * 3040 3134 * @return string HTML for the pagination count. 3041 3135 */ 3042 3136 function bp_get_members_invitations_pagination_count() { 3043 $query_loop = buddypress()->members->invitations->query_loop; 3137 $bp = buddypress(); 3138 $query_loop = $bp->members->invitations->query_loop; 3044 3139 $start_num = intval( ( $query_loop->pag_page - 1 ) * $query_loop->pag_num ) + 1; 3045 3140 $from_num = bp_core_number_format( $start_num ); … … 3077 3172 * @since 8.0.0 3078 3173 * 3174 * @global BuddyPress $bp The one true BuddyPress instance. 3175 * 3079 3176 * @return string HTML for the pagination links. 3080 3177 */ 3081 3178 function bp_get_members_invitations_pagination_links() { 3179 $bp = buddypress(); 3082 3180 3083 3181 /** … … 3088 3186 * @param string $pag_links HTML for the pagination links. 3089 3187 */ 3090 return apply_filters( 'bp_get_members_invitations_pagination_links', buddypress()->members->invitations->query_loop->pag_links );3188 return apply_filters( 'bp_get_members_invitations_pagination_links', $bp->members->invitations->query_loop->pag_links ); 3091 3189 } 3092 3190 -
trunk/src/bp-members/bp-members-widgets.php
r11381 r13105 19 19 */ 20 20 function bp_members_register_widgets() { 21 add_action( 'widgets_init', function() { return register_widget( 'BP_Core_Members_Widget' ); } ); 22 add_action( 'widgets_init', function() { return register_widget( 'BP_Core_Whos_Online_Widget' ); } ); 23 add_action( 'widgets_init', function() { return register_widget( 'BP_Core_Recently_Active_Widget' ); } ); 21 add_action( 22 'widgets_init', 23 function() { 24 return register_widget( 'BP_Core_Members_Widget' ); 25 } 26 ); 27 28 add_action( 29 'widgets_init', 30 function() { 31 return register_widget( 'BP_Core_Whos_Online_Widget' ); 32 } 33 ); 34 35 add_action( 36 'widgets_init', 37 function() { 38 return register_widget( 'BP_Core_Recently_Active_Widget' ); 39 } 40 ); 24 41 } 25 42 add_action( 'bp_register_widgets', 'bp_members_register_widgets' ); … … 103 120 <?php endif; 104 121 } 105 add_action( 'wp_ajax_widget_members', 122 add_action( 'wp_ajax_widget_members', 'bp_core_ajax_widget_members' ); 106 123 add_action( 'wp_ajax_nopriv_widget_members', 'bp_core_ajax_widget_members' ); -
trunk/src/bp-members/classes/class-bp-core-members-template.php
r12852 r13105 111 111 * 112 112 * @since 1.5.0 113 * @since 7.0.0 Added $xprofile_query parameter. Added $user_idsparameter.113 * @since 7.0.0 Added `$xprofile_query` parameter. Added `$user_ids` parameter. 114 114 * 115 115 * @see BP_User_Query for an in-depth description of parameters. 116 116 * 117 * @param array $args {117 * @param array ...$args { 118 118 * Array of arguments. Supports all arguments of BP_User_Query. Additional 119 119 * arguments, or those with different defaults, are described below. … … 268 268 * @return bool True if there are items in the loop, otherwise false. 269 269 */ 270 function has_members() { 271 if ( $this->member_count ) 272 return true; 273 274 return false; 270 public function has_members() { 271 return ! empty( $this->member_count ); 275 272 } 276 273 … … 282 279 * @return object The next member to iterate over. 283 280 */ 284 function next_member() {281 public function next_member() { 285 282 $this->current_member++; 286 $this->member = $this->members[ $this->current_member];283 $this->member = $this->members[ $this->current_member ]; 287 284 288 285 return $this->member; … … 294 291 * @since 1.0.0 295 292 */ 296 function rewind_members() {293 public function rewind_members() { 297 294 $this->current_member = -1; 298 295 if ( $this->member_count > 0 ) { … … 314 311 * @return bool True if there are more members to show, otherwise false. 315 312 */ 316 function members() {313 public function members() { 317 314 if ( $this->current_member + 1 < $this->member_count ) { 318 315 return true; 319 } elseif ( $this->current_member + 1 == $this->member_count ) {316 } elseif ( $this->current_member + 1 === $this->member_count ) { 320 317 321 318 /** … … 344 341 * @see bp_the_member() 345 342 */ 346 function the_member() { 347 343 public function the_member() { 348 344 $this->in_the_loop = true; 349 345 $this->member = $this->next_member(); 350 346 351 347 // Loop has just started. 352 if ( 0 == $this->current_member ) {348 if ( 0 === $this->current_member ) { 353 349 354 350 /** … … 359 355 do_action( 'member_loop_start' ); 360 356 } 361 362 357 } 363 358 }
Note: See TracChangeset
for help on using the changeset viewer.