Skip to:
Content

BuddyPress.org

Changeset 13105


Ignore:
Timestamp:
09/11/2021 05:26:17 PM (3 months ago)
Author:
espellcaste
Message:

Making PHPDoc Improvements to the BP Members (component) files.

Also, adding several minor PHP changes.

See #8553

Location:
trunk/src
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-friends/bp-friends-functions.php

    r13092 r13105  
    272272 * @since 1.2.0
    273273 *
    274  * @global object $friends_template
     274 * @global BP_Core_Members_Template $members_template
    275275 *
    276276 * @param int $user_id            ID of the first user.
  • trunk/src/bp-friends/bp-friends-template.php

    r13092 r13105  
    244244     * Return value is a string of the form "x friends".
    245245     *
    246      * @global object $members_template
     246     * @global BP_Core_Members_Template $members_template
    247247     *
    248248     * @since 1.2.0
     
    538538     * @since 1.2.0
    539539     *
    540      * @global object $members_template
     540     * @global BP_Core_Members_Template $members_template
    541541     *
    542542     * @return int ID of the friendship.
     
    573573     * @since 1.0.0
    574574     *
    575      * @global object $members_template
     575     * @global BP_Core_Members_Template $members_template
    576576     *
    577577     * @return string accept-friendship URL.
     
    610610     * @since 1.0.0
    611611     *
    612      * @global object $members_template
     612     * @global BP_Core_Members_Template $members_template
    613613     *
    614614     * @return string reject-friendship URL.
  • trunk/src/bp-friends/classes/class-bp-core-friends-widget.php

    r13092 r13105  
    5353     * @since 1.9.0
    5454     *
    55      * @global object $members_template
     55     * @global BP_Core_Members_Template $members_template
    5656     *
    5757     * @param array $args Widget arguments.
  • trunk/src/bp-members/bp-members-activity.php

    r12926 r13105  
    1515 *
    1616 * @since 2.2.0
    17  *
    1817 */
    1918function bp_members_register_activity_actions() {
  • trunk/src/bp-members/bp-members-admin.php

    r12824 r13105  
    5555 * @param  boolean $exists  True if the member type already exists. False otherwise.
    5656 * @param  string  $type_id The member type identifier.
    57  * @return boolean          True if the member type already exists. False otherwise.
     57 * @return bool True if the member type already exists. False otherwise.
    5858 */
    5959function bp_members_type_admin_type_exists( $exists = false, $type_id = '' ) {
     
    7171 * @since 7.0.0
    7272 *
    73  * @param array  $messages The feedback messages.
    74  * @return array           The feedback messages including the ones for the Member Types Admin actions.
     73 * @param array $messages The feedback messages.
     74 * @return array The feedback messages including the ones for the Member Types Admin actions.
    7575 */
    7676function bp_members_type_admin_updated_messages( $messages = array() ) {
  • trunk/src/bp-members/bp-members-cache.php

    r13098 r13105  
    1818 * @param BP_User_Query $bp_user_query BP_User_Query object.
    1919 */
    20 function bp_members_prefetch_member_type( BP_User_Query $bp_user_query ) {
     20function bp_members_prefetch_member_type( $bp_user_query ) {
    2121    $uncached_member_ids = bp_get_non_cached_ids( $bp_user_query->user_ids, 'bp_member_member_type' );
    2222
  • trunk/src/bp-members/bp-members-cssjs.php

    r13003 r13105  
    99
    1010// Exit if accessed directly.
    11 if ( ! defined( 'ABSPATH' ) ) {
    12     exit;
    13 }
     11defined( 'ABSPATH' ) || exit;
    1412
    1513/**
     
    2321function bp_members_register_scripts( $scripts = array() ) {
    2422    $scripts['bp-dynamic-members-script'] = array(
     23        'footer'       => true,
    2524        'file'         => plugins_url( 'js/dynamic-members.js', __FILE__ ),
    2625        'dependencies' => array(
     
    2827            'wp-i18n',
    2928        ),
    30         'footer'       => true,
    3129    );
    3230
  • trunk/src/bp-members/bp-members-filters.php

    r12945 r13105  
    1616 * Escape commonly used fullname output functions.
    1717 */
    18 add_filter( 'bp_displayed_user_fullname',    'esc_html' );
     18add_filter( 'bp_displayed_user_fullname', 'esc_html' );
    1919add_filter( 'bp_get_loggedin_user_fullname', 'esc_html' );
    2020
     
    135135 *
    136136 * @param bool   $retval     Whether or not the current user has the capability.
    137  * @param int    $user_id
     137 * @param int    $user_id    User ID.
    138138 * @param string $capability The capability being checked for.
    139139 * @param int    $site_id    Site ID. Defaults to the BP root blog.
     
    327327 * @param int|string $value    The value for the requested property.
    328328 * @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.
    330330 * @return int|string          The sanitized value.
    331331 */
  • trunk/src/bp-members/bp-members-functions.php

    r12935 r13105  
    2323    $bp = buddypress();
    2424
    25     return (bool) !empty( $bp->pages->members->id );
     25    return (bool) ! empty( $bp->pages->members->id );
    2626}
    2727
     
    3838 *
    3939 * @since 1.5.0
     40 *
     41 * @global BuddyPress $bp The one true BuddyPress instance.
    4042 */
    4143function bp_core_define_slugs() {
     
    207209    // Don't use this filter.  Subject to removal in a future release.
    208210    // Use the 'bp_core_get_user_domain' filter instead.
    209     $domain       = apply_filters( 'bp_core_get_user_domain_pre_cache', $domain, $user_id, $user_nicename, $user_login );
     211    $domain = apply_filters( 'bp_core_get_user_domain_pre_cache', $domain, $user_id, $user_nicename, $user_login );
    210212
    211213    /**
     
    227229 * @since 1.2.0
    228230 *
    229  * @param  int $user_id The ID of the user.
    230  * @return array|bool Array of data on success, boolean false on failure.
     231 * @param int $user_id The ID of the user.
     232 * @return array|bool Array of data on success, false on failure.
    231233 */
    232234function bp_core_get_core_userdata( $user_id = 0 ) {
     
    235237    }
    236238
    237     // Get core user data
     239    // Get core user data.
    238240    $userdata = BP_Core_User::get_core_userdata( $user_id );
    239241
     
    243245     * @since 1.2.0
    244246     *
    245      * @param array|bool $userdata Array of user data for a passed user on success, boolean false on failure.
     247     * @param array|bool $userdata Array of user data for a passed user on success, false on failure.
    246248     */
    247249    return apply_filters( 'bp_core_get_core_userdata', $userdata );
     
    285287     * @param string   $username User login to check.
    286288     */
    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 );
    288290}
    289291
     
    311313     * @param string   $user_nicename User nicename to check.
    312314     */
    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 );
    314316}
    315317
     
    362364 */
    363365function bp_members_get_user_nicename( $user_id ) {
     366
    364367    /**
    365368     * Filters the user_nicename based on originally provided user ID.
     
    377380 * @since 1.0.0
    378381 *
    379  * @param int $uid User ID to check.
     382 * @param int $user_id User ID to check.
    380383 * @return string The email for the matched user. Empty string if no user
    381384 *                matches the $user_id.
    382385 */
    383386function bp_core_get_user_email( $user_id ) {
     387
    384388    /**
    385389     * Filters the user email for user based on user ID.
     
    508512}
    509513add_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'      );
     514add_filter( 'bp_core_get_user_displayname', 'trim' );
     515add_filter( 'bp_core_get_user_displayname', 'stripslashes' );
     516add_filter( 'bp_core_get_user_displayname', 'esc_html' );
    513517
    514518/**
     
    569573 * @since 1.2.0
    570574 *
     575 * @global wpdb $wpdb WordPress database object.
     576 *
    571577 * @return int The total number of members.
    572578 */
     
    596602 *
    597603 * @since 1.6.0
     604 *
     605 * @global wpdb $wpdb WordPress database object.
    598606 *
    599607 * @return int The number of active members.
     
    635643 * @since 5.0.0
    636644 *
    637  * @param int   $user_id The user ID to spam or ham.
    638  * @param int   $value   0 to mark the user as `ham`, 1 to mark as `spam`.
     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`.
    639647 * @return bool          True if the spam status of the member changed.
    640648 *                       False otherwise.
     
    677685 * @since 1.6.0
    678686 *
     687 * @global wpdb $wpdb WordPress database object.
     688 *
    679689 * @param int    $user_id       The ID of the user being spammed/hammed.
    680690 * @param string $status        'spam' if being marked as spam, 'ham' otherwise.
    681  * @param bool   $do_wp_cleanup True to force the cleanup of WordPress content
     691 * @param bool   $do_wp_cleanup Optional. True to force the cleanup of WordPress content
    682692 *                              and status, otherwise false. Generally, this should
    683693 *                              only be false if WordPress is expected to have
     
    708718    // Only you can prevent infinite loops.
    709719    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' );
    711721
    712722    // Force the cleanup of WordPress content and status for multisite configs.
     
    833843    // Put things back how we found them.
    834844    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' );
    836846
    837847    return true;
     
    865875 *
    866876 * @since 1.6.0
     877 *
     878 * @global BuddyPress $bp The one true BuddyPress instance.
    867879 *
    868880 * @param int $user_id The ID for the user.
     
    937949 * @since 1.6.0
    938950 *
     951 * @global BuddyPress $bp The one true BuddyPress instance.
     952 *
    939953 * @param int $user_id The ID for the user.
    940954 * @return bool True if deleted, otherwise false.
     
    10031017 * @since 1.6.0
    10041018 *
    1005  * @param int $user_id The user ID to check.
     1019 * @param int $user_id Optional. The user ID to check.
    10061020 * @return bool True if active, otherwise false.
    10071021 */
     
    10371051 * @since 1.6.0
    10381052 *
    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.
    10431054 * @return bool True if inactive, otherwise false.
    10441055 */
    10451056function 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 
    10571057    // Return the inverse of active.
    1058     return !bp_is_user_active( $user_id );
     1058    return ! bp_is_user_active( $user_id );
    10591059}
    10601060
     
    10661066 *              legacy user query is enabled.
    10671067 *
    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.
    10701070 * @return bool True on success, false on failure.
    10711071 */
     
    12111211 * @since 2.0.0
    12121212 *
     1213 * @global BuddyPress $bp The one true BuddyPress instance.
     1214 * @global wpdb $wpdb WordPress database object.
     1215 *
    12131216 * @return bool
    12141217 */
     
    15141517 * @since 1.2.7
    15151518 *
    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.
    15191521 * @return array Merged and unique array of illegal names.
    15201522 */
    1521 function bp_core_get_illegal_names( $value = '', $oldvalue = '' ) {
     1523function bp_core_get_illegal_names( $value = '' ) {
    15221524
    15231525    // Make sure $value is array.
     
    15451547        'notifications',
    15461548        'register',
    1547         'activate'
     1549        'activate',
    15481550    );
    15491551
     
    15631565        'BP_ACTIVATION_SLUG',
    15641566    );
    1565     foreach( $slug_constants as $constant ) {
     1567    foreach ( $slug_constants as $constant ) {
    15661568        if ( defined( $constant ) ) {
    15671569            $bp_component_slugs[] = constant( $constant );
     
    15881590
    15891591    // First merge BuddyPress illegal names.
    1590     $bp_merged_names           = array_merge( (array) $filtered_illegal_names, (array) $db_illegal_names );
     1592    $bp_merged_names = array_merge( (array) $filtered_illegal_names, (array) $db_illegal_names );
    15911593
    15921594    // Then merge WordPress and BuddyPress illegal names.
    1593     $merged_names              = array_merge( (array) $wp_filtered_illegal_names, (array) $bp_merged_names );
     1595    $merged_names = array_merge( (array) $wp_filtered_illegal_names, (array) $bp_merged_names );
    15941596
    15951597    // Remove duplicates.
    1596     $illegal_names             = array_unique( (array) $merged_names );
     1598    $illegal_names = array_unique( (array) $merged_names );
    15971599
    15981600    /**
     
    16051607    return apply_filters( 'bp_core_illegal_names', $illegal_names );
    16061608}
    1607 add_filter( 'pre_update_site_option_illegal_names', 'bp_core_get_illegal_names', 10, 2 );
     1609add_filter( 'pre_update_site_option_illegal_names', 'bp_core_get_illegal_names' );
    16081610
    16091611/**
     
    18601862 *
    18611863 * @since 1.2.0
     1864 *
     1865 * @global BuddyPress $bp The one true BuddyPress instance.
    18621866 *
    18631867 * @todo There appears to be a bug in the return value on success.
     
    19951999 * @since 1.2.2
    19962000 *
     2001 * @global wpdb $wpdb WordPress database object.
     2002 *
    19972003 * @param string $key Activation key.
    19982004 * @return int|bool User ID on success, false on failure.
     
    21182124                $current_field = isset( $user['meta']["field_{$field_id}"] ) ? $user['meta']["field_{$field_id}"] : false;
    21192125
    2120                 if ( !empty( $current_field ) ) {
     2126                if ( ! empty( $current_field ) ) {
    21212127                    xprofile_set_field_data( $field_id, $user_id, $current_field );
    21222128                }
     
    22002206 *
    22012207 * @since 2.0.1
     2208 *
     2209 * @global wpdb $wpdb WordPress database object.
    22022210 */
    22032211function bp_members_migrate_signups() {
     
    23152323 * @since 1.1.0
    23162324 *
     2325 * @global BuddyPress $bp The one true BuddyPress instance.
     2326 *
    23172327 * @return string|bool Directory path on success, false on failure.
    23182328 */
     
    23442354        'basedir' => $newbdir,
    23452355        'baseurl' => $newburl,
    2346         'error'   => false
     2356        'error'   => false,
    23472357    ) );
    23482358}
     
    26222632 * @since 2.6.0
    26232633 *
     2634 * @global BuddyPress $bp The one true BuddyPress instance.
     2635 *
    26242636 * @return object The displayed user object, null otherwise.
    26252637 */
     
    26522664    echo bp_get_member_type_tax_name();
    26532665}
    2654 
    26552666    /**
    26562667     * Return the slug of the member type taxonomy.
     
    26612672     */
    26622673    function bp_get_member_type_tax_name() {
     2674
    26632675        /**
    26642676         * Filters the slug of the member type taxonomy.
     
    26902702        'bp_get_member_type_tax_labels',
    26912703        array(
    2692 
    2693             // General labels
     2704            // General labels.
    26942705            'name'                       => _x( 'Member Types', 'Member type taxonomy name', 'buddypress' ),
    26952706            'singular_name'              => _x( 'Member Type', 'Member type taxonomy singular name', 'buddypress' ),
     
    28062817 * @since 2.2.0
    28072818 *
     2819 * @global BuddyPress $bp The one true BuddyPress instance.
     2820 *
    28082821 * @param string $member_type Unique string identifier for the member type.
    28092822 * @param array  $args {
     
    29112924 *
    29122925 * @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.
    29142927 */
    29152928function bp_get_member_type_object( $member_type ) {
     
    29272940 *
    29282941 * @since 2.2.0
     2942 *
     2943 * @global BuddyPress $bp The one true BuddyPress instance.
    29292944 *
    29302945 * @see bp_register_member_type() for accepted arguments.
     
    29402955 */
    29412956function bp_get_member_types( $args = array(), $output = 'names', $operator = 'and' ) {
    2942     $types = buddypress()->members->types;
     2957    $bp    = buddypress();
     2958    $types = $bp->members->types;
    29432959
    29442960    // Merge with types available into the database.
     
    30523068 * @param bool         $append      Optional. True to append this to existing types for user,
    30533069 *                                  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()}.
    30553071 */
    30563072function bp_set_member_type( $user_id, $member_type, $append = false ) {
     
    31503166
    31513167        if ( ! is_wp_error( $raw_types ) ) {
    3152             $types =  array();
     3168            $types = array();
    31533169
    31543170            // Only include currently registered group types.
     
    31833199     * @since 2.2.0
    31843200     *
    3185      * @param string|array|bool $type    a single member type (if $single is true) or an array of member types
     3201     * @param string|array|bool $type    A single member type (if $single is true) or an array of member types
    31863202     *                                   (if $single is false) or false on failure.
    31873203     * @param int               $user_id ID of the user.
     
    32133229    }
    32143230
    3215     return in_array( $member_type, $types );
     3231    return in_array( $member_type, $types, true );
    32163232}
    32173233
     
    32223238 *
    32233239 * @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()}.
    32253241 */
    32263242function bp_remove_member_type_on_user_delete( $user_id ) {
     
    32503266 * @since 2.3.0
    32513267 *
     3268 * @global BuddyPress $bp The one true BuddyPress instance.
     3269 *
    32523270 * @return string
    32533271 */
    32543272function bp_get_current_member_type() {
     3273    $bp = buddypress();
    32553274
    32563275    /**
     
    32613280     * @param string $value "Current" member type.
    32623281     */
    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 );
    32643283}
    32653284
     
    32853304    }
    32863305
    3287     $path      = bp_core_avatar_upload_path() . '/' . $directory. '/' . $user_id;
     3306    $path      = bp_core_avatar_upload_path() . '/' . $directory . '/' . $user_id;
    32883307    $newbdir   = $path;
    3289     $newurl    = bp_core_avatar_url() . '/' . $directory. '/' . $user_id;
     3308    $newurl    = bp_core_avatar_url() . '/' . $directory . '/' . $user_id;
    32903309    $newburl   = $newurl;
    3291     $newsubdir = '/' . $directory. '/' . $user_id;
     3310    $newsubdir = '/' . $directory . '/' . $user_id;
    32923311
    32933312    /**
     
    33043323        'basedir' => $newbdir,
    33053324        'baseurl' => $newburl,
    3306         'error'   => false
     3325        'error'   => false,
    33073326    ) );
    33083327}
     
    33133332 * @since 8.0.0
    33143333 *
    3315  * @param int $user_id The new user's ID
     3334 * @param int $user_id The new user's ID.
    33163335 */
    33173336function bp_send_welcome_email( $user_id = 0 ) {
     
    33493368 * @since 8.0.0
    33503369 *
    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.
    33553372 */
    33563373function bp_members_invitations_get_invites( $args = array() ) {
     
    34113428            'date_modified' => bp_core_current_time(),
    34123429            'content'       => '',
    3413             'send_invite'   => 0
     3430            'send_invite'   => 0,
    34143431        ),
    34153432        'members_invitations_invite_user'
     
    34223439        'date_modified' => $r['date_modified'],
    34233440        'content'       => $r['content'],
    3424         'send_invite'   => $r['send_invite']
     3441        'send_invite'   => $r['send_invite'],
    34253442    );
    34263443
     
    35503567            'inviter_id'    => null,
    35513568            'accepted'      => null,
    3552             'invite_sent'   => null
     3569            'invite_sent'   => null,
    35533570        ),
    35543571        'members_invitations_delete_invites'
     
    35613578        'inviter_id'    => $r['inviter_id'],
    35623579        'accepted'      => $r['accepted'],
    3563         'invite_sent'   => $r['invite_sent']
     3580        'invite_sent'   => $r['invite_sent'],
    35643581    );
    35653582
     
    35853602 * @since 8.0.0
    35863603 *
    3587  * @param BP_Invitation object $invitation Invitation to create hash from.
     3604 * @param BP_Invitation $invitation Invitation to create hash from.
    35883605 *
    35893606 * @return string $hash Calculated sha1 hash.
    35903607 */
    3591 function bp_members_invitations_get_hash( BP_Invitation $invitation ) {
     3608function bp_members_invitations_get_hash( $invitation ) {
    35923609    $hash = false;
    35933610
     
    36133630     * @since 8.0.0
    36143631     *
    3615      * @param string $hash Calculated 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.
    36173634     */
    36183635    return apply_filters( 'bp_members_invitations_get_hash', $hash, $invitation );
  • trunk/src/bp-members/bp-members-invitations.php

    r12961 r13105  
    7070 * @since 8.0.0
    7171 *
    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 *
    7876 * @return bool Whether or not to send the activation key.
    7977 */
    80 function bp_members_invitations_cancel_activation_email( $send, $user_id = 0, $user_email = '', $activation_key = '', $usermeta = array() ) {
     78function bp_members_invitations_cancel_activation_email( $send, $user_id = 0, $user_email = '' ) {
    8179    $invite = bp_members_invitations_get_invites(
    8280        array(
    8381            'invitee_email' => $user_email,
    84             'invite_sent'   => 'sent'
     82            'invite_sent'   => 'sent',
    8583        )
    8684    );
     
    9290    return $send;
    9391}
    94 add_filter( 'bp_core_signup_send_activation_key', 'bp_members_invitations_cancel_activation_email', 10, 5 );
     92add_filter( 'bp_core_signup_send_activation_key', 'bp_members_invitations_cancel_activation_email', 10, 3 );
    9593
    9694/**
     
    10199 * @since 8.0.0
    102100 *
    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.
    107104 */
    108 function bp_members_invitations_complete_signup( $user_id, $user_login = '', $user_password = '', $user_email = '' ) {
     105function bp_members_invitations_complete_signup( $user_id ) {
     106    $bp = buddypress();
     107
    109108    if ( ! $user_id ) {
    110109        return;
     
    147146    }
    148147}
    149 add_action( 'bp_core_signup_user', 'bp_members_invitations_complete_signup', 10, 4 );
     148add_action( 'bp_core_signup_user', 'bp_members_invitations_complete_signup' );
    150149
    151150/**
     
    157156 */
    158157function 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        )
    162162    );
    163     bp_members_invitations_delete_invites( $args );
    164163}
    165164add_action( 'bp_optout_after_save', 'bp_members_invitations_delete_optedout_invites' );
  • trunk/src/bp-members/bp-members-loader.php

    r11360 r13105  
    44 *
    55 * @package BuddyPress
    6  * @subpackage Members
     6 * @subpackage MembersLoader
    77 * @since 1.5.0
    88 */
  • trunk/src/bp-members/bp-members-notifications.php

    r12933 r13105  
    129129        return;
    130130    }
    131     foreach ( $invites as $invite) {
     131
     132    foreach ( $invites as $invite ) {
    132133        // Include the id of the "accepted" invitation.
    133134        if ( $invite->inviter_id === $inviter_id ) {
     
    137138            $secondary_item_id = 0;
    138139        }
    139         $res = bp_notifications_add_notification( array(
     140
     141        bp_notifications_add_notification( array(
    140142            'user_id'           => $invite->inviter_id,
    141143            'item_id'           => $new_user->ID,
     
    153155 * Mark accepted invitation notifications as read when user visits new user profile.
    154156 *
    155  *
    156157 * @since 8.0.0
    157158 */
     
    164165    BP_Notifications_Notification::update(
    165166        array(
    166             'is_new'  => false
     167            'is_new' => false,
    167168        ),
    168169        array(
     
    226227        </tbody>
    227228    </table>
    228 
    229229<?php
    230230}
  • trunk/src/bp-members/bp-members-template.php

    r12951 r13105  
    66 *
    77 * @package BuddyPress
    8  * @subpackage Members
     8 * @subpackage MembersTemplate
    99 * @since 1.5.0
    1010 */
     
    1717 *
    1818 * @since 2.4.0
    19  *
    2019 */
    2120function bp_profile_slug() {
     
    4544 *
    4645 * @since 1.5.0
    47  *
    4846 */
    4947function bp_members_slug() {
     
    7371 *
    7472 * @since 1.5.0
    75  *
    7673 */
    7774function bp_members_root_slug() {
     
    9289         * @since 1.5.0
    9390         *
    94          * @param string $slug Members component root slug.
     91         * @param string $root_slug Members component root slug.
    9592         */
    9693        return apply_filters( 'bp_get_members_root_slug', buddypress()->members->root_slug );
     
    106103}
    107104    /**
    108      * Get the member type base slug.
     105     * Get the member type URL base.
    109106     *
    110107     * The base slug is the string used as the base prefix when generating member type directory URLs.
     
    117114     */
    118115    function bp_get_members_member_type_base() {
     116
    119117        /**
    120118         * Filters the member type URL base.
     
    122120         * @since 2.3.0
    123121         *
    124          * @param string $base
     122         * @param string $base Base slug for the member type.
    125123         */
    126124        return apply_filters( 'bp_members_member_type_base', _x( 'type', 'member type URL base', 'buddypress' ) );
     
    131129 *
    132130 * @since 1.5.0
    133  *
    134131 */
    135132function bp_members_directory_permalink() {
     
    160157 * @since 2.5.0
    161158 *
    162  * @param string $member_type Optional. Member type.
     159 * @param string $member_type Optional. Member type. Defaults to current member type.
    163160 */
    164161function bp_member_type_directory_permalink( $member_type = '' ) {
     
    205202 *
    206203 * @since 1.5.0
    207  *
    208204 */
    209205function bp_signup_slug() {
     
    215211     * @since 1.5.0
    216212     *
     213     * @global BuddyPress $bp The one true BuddyPress instance.
     214     *
    217215     * @return string
    218216     */
     
    220218        $bp = buddypress();
    221219
    222         if ( !empty( $bp->pages->register->slug ) ) {
     220        if ( ! empty( $bp->pages->register->slug ) ) {
    223221            $slug = $bp->pages->register->slug;
    224222        } elseif ( defined( 'BP_REGISTER_SLUG' ) ) {
     
    242240 *
    243241 * @since 1.5.0
    244  *
    245242 */
    246243function bp_activate_slug() {
     
    252249     * @since 1.5.0
    253250     *
     251     * @global BuddyPress $bp The one true BuddyPress instance.
     252     *
    254253     * @return string
    255254     */
     
    257256        $bp = buddypress();
    258257
    259         if ( !empty( $bp->pages->activate->slug ) ) {
     258        if ( ! empty( $bp->pages->activate->slug ) ) {
    260259            $slug = $bp->pages->activate->slug;
    261260        } elseif ( defined( 'BP_ACTIVATION_SLUG' ) ) {
     
    279278 *
    280279 * @since 8.0.0
    281  *
    282280 */
    283281function bp_members_invitations_slug() {
     
    313311 * @since 7.0.0 Added `xprofile_query` parameter. Added `user_ids` parameter.
    314312 *
    315  * @global object $members_template {@link BP_Members_Template}
     313 * @global BP_Core_Members_Template $members_template
    316314 *
    317315 * @param array|string $args {
     
    440438     * @since 2.6.0 Added the `$r` parameter
    441439     *
    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.
    445443     */
    446444    return apply_filters( 'bp_has_members', $members_template->has_members(), $members_template, $r );
     
    451449 *
    452450 * @since 1.2.0
     451 *
     452 * @global BP_Core_Members_Template $members_template
    453453 *
    454454 * @return object
     
    464464 * @since 1.2.0
    465465 *
     466 * @global BP_Core_Members_Template $members_template
     467 *
    466468 * @return bool
    467469 */
     
    484486     * @since 1.5.0
    485487     *
     488     * @global BP_Core_Members_Template $members_template
     489     *
    486490     * @return string
    487491     */
     
    489493        global $members_template;
    490494
    491         if ( empty( $members_template->type ) )
     495        if ( empty( $members_template->type ) ) {
    492496            $members_template->type = '';
     497        }
    493498
    494499        $start_num = intval( ( $members_template->pag_page - 1 ) * $members_template->pag_num ) + 1;
     
    550555     * @since 1.2.0
    551556     *
     557     * @global BP_Core_Members_Template $members_template
     558     *
    552559     * @return string
    553560     */
     
    569576 *
    570577 * @since 1.2.0
    571  *
    572578 */
    573579function bp_member_user_id() {
     
    579585     * @since 1.2.0
    580586     *
    581      * @return string Member ID.
     587     * @global BP_Core_Members_Template $members_template
     588     *
     589     * @return int Member ID.
    582590     */
    583591    function bp_get_member_user_id() {
    584592        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;
    586597
    587598        /**
     
    592603         * @param int $member_id ID of the member being iterated over.
    593604         */
    594         return apply_filters( 'bp_get_member_user_id', $member_id );
     605        return apply_filters( 'bp_get_member_user_id', (int) $member_id );
    595606    }
    596607
     
    610621     * @since 1.7.0
    611622     *
     623     * @global BP_Core_Members_Template $members_template
     624     *
    612625     * @param array $classes Array of custom classes.
     626     *
    613627     * @return string Row class of the member
    614628     */
     
    679693     * @since 1.2.5
    680694     *
     695     * @global BP_Core_Members_Template $members_template
     696     *
    681697     * @return string Members nicename.
    682698     */
     
    707723     * @since 1.2.5
    708724     *
     725     * @global BP_Core_Members_Template $members_template
     726     *
    709727     * @return string Member's login.
    710728     */
     
    735753     * @since 1.2.5
    736754     *
     755     * @global BP_Core_Members_Template $members_template
     756     *
    737757     * @return string Member's email address.
    738758     */
     
    754774 *
    755775 * @since 1.2.5
     776 * @since 10.0.0 Updated to get member ID from `bp_get_member_user_id`.
    756777 *
    757778 * @return bool
    758779 */
    759780function bp_member_is_loggedin_user() {
    760     global $members_template;
    761781
    762782    /**
     
    767787     * @param bool $value Whether current member in the loop is logged in.
    768788     */
    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() ) );
    770790}
    771791
     
    796816     *
    797817     * @since 1.2.0
     818     *
     819     * @global BP_Core_Members_Template $members_template
    798820     *
    799821     * @see bp_core_fetch_avatar() For a description of arguments and
     
    809831     *     @type int|bool $width   Default: false.
    810832     *     @type int|bool $height  Default: false.
     833     *     @type bool     $no_grav Default: false.
    811834     *     @type bool     $id      Currently unused.
    812      *     @type bool     $no_grav Default: false.
    813835     * }
    814836     * @return string User avatar string.
     
    817839        global $members_template;
    818840
    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            )
    828857        );
    829858
    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.
    835875         *
    836876         * @since 1.2.0
     
    840880         * @param array  $r     Array of parsed arguments. See {@link bp_get_member_avatar()}.
    841881         */
    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 );
    843883    }
    844884
     
    856896     * @since 1.2.0
    857897     *
     898     * @global BP_Core_Members_Template $members_template
     899     *
    858900     * @return string
    859901     */
     
    876918     * @since 1.2.0
    877919     */
    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    }
    879923
    880924    /**
     
    883927     * @since 1.2.0
    884928     */
    885     function bp_get_member_link() { return bp_get_member_permalink(); }
     929    function bp_get_member_link() {
     930        return bp_get_member_permalink();
     931    }
    886932
    887933/**
     
    910956     *
    911957     * @since 1.2.0
     958     *
     959     * @global BP_Core_Members_Template $members_template
    912960     *
    913961     * @return string The user's fullname for display.
     
    9641012     * @since 2.7.0 Added 'relative' as a parameter to $args.
    9651013     *
     1014     * @global BP_Core_Members_Template $members_template
     1015     *
    9661016     * @param array $args {
    9671017     *     Array of optional arguments.
     
    10321082     * @since 1.2.0
    10331083     *
     1084     * @global BP_Core_Members_Template $members_template
     1085     *
    10341086     * @param array|string $args {
    10351087     *     Array of optional arguments.
     
    11081160     *
    11091161     * @since 1.2.0
     1162     *
     1163     * @global BP_Core_Members_Template $members_template
    11101164     *
    11111165     * @param array|string $args {
     
    11981252 * @since 2.7.0 Added $args as a parameter.
    11991253 *
    1200  * @param array $args Optional. {@see bp_get_member_registered()}
     1254 * @param array $args Optional. {@see bp_get_member_registered()}.
    12011255 */
    12021256function bp_member_registered( $args = array() ) {
     
    12071261     *
    12081262     * @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
    12101266     *
    12111267     * @param array $args {
    12121268     *     Array of optional parameters.
    1213      *
    12141269     *     @type bool $relative Optional. If true, returns relative registered date. eg. registered 5 months ago.
    12151270     *                          If false, returns registered date value from database.
    12161271     * }
    1217      *
    12181272     * @return string
    12191273     */
     
    12401294         *
    12411295         * @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 );
    12441299    }
    12451300
     
    12481303 *
    12491304 * @since 1.2.0
     1305 * @since 10.0.0 Updated to get member ID using `bp_get_member_user_id`.
    12501306 */
    12511307function bp_member_random_profile_data() {
    1252     global $members_template;
    1253 
    12541308    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 ); ?>
    12561310            <strong><?php echo wp_filter_kses( $random_data[0]->name ) ?></strong>
    12571311            <?php echo wp_filter_kses( $random_data[0]->value ) ?>
     
    13231377     * @since 1.2.0
    13241378     *
    1325      * @return int
     1379     * @return string
    13261380     */
    13271381    function bp_get_total_site_member_count() {
     
    13521406 *
    13531407 * @since 1.1.0
     1408 *
     1409 * @global BuddyPress $bp The one true BuddyPress instance.
    13541410 *
    13551411 * @todo Move to a back-compat file?
     
    14421498    }
    14431499
    1444     // Init the hierarchy
     1500    // Init the hierarchy.
    14451501    $template_names = array(
    14461502        'members/single/front-id-' . (int) $displayed_user->id . '.php',
     
    14601516        }
    14611517
    1462         $template_names[] = 'members/single/front-member-type-' . sanitize_file_name( $displayed_user_member_type )   . '.php';
    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.
    14661522    $template_names[] = 'members/single/front.php';
    14671523
     
    14711527     * @since 2.6.0
    14721528     *
    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 );
    14761534}
    14771535
     
    14911549 *
    14921550 * @since 1.1.0
     1551 *
     1552 * @global BuddyPress $bp The one true BuddyPress instance.
    14931553 */
    14941554function bp_get_displayed_user_nav() {
     
    16651725     * @since 1.5.0
    16661726     *
     1727     * @global BuddyPress $bp The one true BuddyPress instance.
     1728     *
    16671729     * @return string
    16681730     */
     
    16711733
    16721734        // 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 ) ) {
    16741736            $retval = $bp->displayed_user->userdata->user_email;
    1675         else
     1737        } else {
    16761738            $retval = '';
     1739        }
    16771740
    16781741        /**
     
    16961759 */
    16971760function 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 );
    17071762}
    17081763    /**
     
    17581813
    17591814        // Try to get displayed user.
    1760         if ( empty( $name ) )
     1815        if ( empty( $name ) ) {
    17611816            $name = bp_get_displayed_user_fullname();
     1817        }
    17621818
    17631819        // Fall back on logged in user.
    1764         if ( empty( $name ) )
     1820        if ( empty( $name ) ) {
    17651821            $name = bp_get_loggedin_user_fullname();
     1822        }
    17661823
    17671824        $fullname = (array) explode( ' ', $name );
     
    18371894     * @deprecated
    18381895     */
    1839     function bp_user_link() { bp_displayed_user_domain(); }
     1896    function bp_user_link() {
     1897        bp_displayed_user_domain();
     1898    }
    18401899
    18411900/**
     
    18441903 * @since 1.0.0
    18451904 */
    1846 function bp_current_user_id() { return bp_displayed_user_id(); }
     1905function bp_current_user_id() {
     1906    return bp_displayed_user_id();
     1907}
    18471908
    18481909/**
     
    18501911 *
    18511912 * @since 1.0.0
     1913 *
     1914 * @global BuddyPress $bp The one true BuddyPress instance.
    18521915 *
    18531916 * @return string
     
    18711934 * @since 1.0.0
    18721935 *
     1936 * @global BuddyPress $bp The one true BuddyPress instance.
     1937 *
    18731938 * @return string
    18741939 */
     
    18991964     * @since 1.2.0
    19001965     *
     1966     * @global BuddyPress $bp The one true BuddyPress instance.
     1967     *
    19011968     * @return string
    19021969     */
     
    19352002     * @since 1.0.0
    19362003     *
     2004     * @global BuddyPress $bp The one true BuddyPress instance.
     2005     *
    19372006     * @return string
    19382007     */
     
    19622031     *
    19632032     * @since 1.2.0
     2033     *
     2034     * @global BuddyPress $bp The one true BuddyPress instance.
    19642035     *
    19652036     * @return string
     
    19962067     *
    19972068     * @since 1.2.0
     2069     *
     2070     * @global BuddyPress $bp The one true BuddyPress instance.
    19982071     *
    19992072     * @return string
     
    20982171 *
    20992172 * @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.
    21012175 *
    21022176 * @param int   $user_id User ID.
     
    21112185     * @since 7.0.0
    21122186     *
    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       {
    21152189     *     Array of parameters. All items are optional.
    21162190     *     @type string $parent_element     Element to wrap around the list. Defaults to 'p'.
     
    22452319    static $has_page = false;
    22462320
    2247     if ( empty( $has_page ) )
     2321    if ( empty( $has_page ) ) {
    22482322        $has_page = bp_get_signup_slug() && bp_locate_template( array( 'registration/register.php', 'members/register.php', 'register.php' ), false );
     2323    }
    22492324
    22502325    return (bool) $has_page;
     
    25062581     * @since 2.1.0
    25072582     *
     2583     * @global WP_Network $current_site
     2584     *
    25082585     * @return string The base URL - eg, 'example.com' for site_url() example.com or www.example.com.
    25092586     */
     
    26022679     * @since 1.1.0
    26032680     *
     2681     * @global BuddyPress $bp The one true BuddyPress instance.
     2682     *
    26042683     * @return string
    26052684     */
     
    26692748     * @since 1.1.0
    26702749     *
     2750     * @global BuddyPress $bp The one true BuddyPress instance.
     2751     *
    26712752     * @return string
    26722753     */
     
    26912772     *
    26922773     * @since 1.1.0
     2774     *
     2775     * @global BuddyPress $bp The one true BuddyPress instance.
    26932776     *
    26942777     * @see bp_core_fetch_avatar() for description of arguments.
     
    27072790
    27082791        $defaults = array(
    2709             'size' => bp_core_avatar_full_width(),
     2792            'size'  => bp_core_avatar_full_width(),
    27102793            'class' => 'avatar',
    2711             'alt' => __( 'Your Profile Photo', 'buddypress' )
     2794            'alt'   => __( 'Your Profile Photo', 'buddypress' ),
    27122795        );
    27132796
     
    27152798        extract( $r, EXTR_SKIP );
    27162799
     2800        $signup_avatar_dir = bp_get_signup_avatar_dir_value();
     2801
    27172802        // Avatar DIR is found.
    2718         if ( $signup_avatar_dir = bp_get_signup_avatar_dir_value() ) {
     2803        if ( $signup_avatar_dir ) {
    27192804            $gravatar_img = bp_core_fetch_avatar( array(
    27202805                'item_id'    => $signup_avatar_dir,
     
    27252810                'height'     => $size,
    27262811                'alt'        => $alt,
    2727                 'class'      => $class
     2812                'class'      => $class,
    27282813            ) );
    27292814
     
    27322817
    27332818            // Set default gravatar type.
    2734             if ( empty( $bp->grav_default->user ) )
     2819            if ( empty( $bp->grav_default->user ) ) {
    27352820                $default_grav = 'wavatar';
    2736             elseif ( 'mystery' == $bp->grav_default->user )
     2821            } elseif ( 'mystery' === $bp->grav_default->user ) {
    27372822                $default_grav = $bp->plugin_url . 'bp-core/images/mystery-man.jpg';
    2738             else
     2823            } else {
    27392824                $default_grav = $bp->grav_default->user;
     2825            }
    27402826
    27412827            /**
     
    27802866     */
    27812867    function bp_get_signup_allowed() {
     2868
    27822869        /**
    27832870         * Filters whether or not new signups are allowed.
     
    29022989    echo bp_get_avatar_delete_link();
    29032990}
    2904 
    29052991    /**
    29062992     * Return an avatar delete link.
     
    29343020 *
    29353021 * @since 8.0.0
     3022 *
     3023 * @global BuddyPress $bp The one true BuddyPress instance.
    29363024 *
    29373025 * @param array|string $args {
     
    30083096 * @since 8.0.0
    30093097 *
     3098 * @global BuddyPress $bp The one true BuddyPress instance.
     3099 *
    30103100 * @return array List of network invitations.
    30113101 */
     
    30193109 * @since 8.0.0
    30203110 *
     3111 * @global BuddyPress $bp The one true BuddyPress instance.
     3112 *
    30213113 * @return object The current network invitation within the loop.
    30223114 */
     
    30383130     * @since 8.0.0
    30393131     *
     3132     * @global BuddyPress $bp The one true BuddyPress instance.
     3133     *
    30403134     * @return string HTML for the pagination count.
    30413135     */
    30423136    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;
    30443139        $start_num  = intval( ( $query_loop->pag_page - 1 ) * $query_loop->pag_num ) + 1;
    30453140        $from_num   = bp_core_number_format( $start_num );
     
    30773172     * @since 8.0.0
    30783173     *
     3174     * @global BuddyPress $bp The one true BuddyPress instance.
     3175     *
    30793176     * @return string HTML for the pagination links.
    30803177     */
    30813178    function bp_get_members_invitations_pagination_links() {
     3179        $bp = buddypress();
    30823180
    30833181        /**
     
    30883186         * @param string $pag_links HTML for the pagination links.
    30893187         */
    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 );
    30913189    }
    30923190
  • trunk/src/bp-members/bp-members-widgets.php

    r11381 r13105  
    1919 */
    2020function 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    );
    2441}
    2542add_action( 'bp_register_widgets', 'bp_members_register_widgets' );
     
    103120    <?php endif;
    104121}
    105 add_action( 'wp_ajax_widget_members',        'bp_core_ajax_widget_members' );
     122add_action( 'wp_ajax_widget_members', 'bp_core_ajax_widget_members' );
    106123add_action( 'wp_ajax_nopriv_widget_members', 'bp_core_ajax_widget_members' );
  • trunk/src/bp-members/classes/class-bp-core-members-template.php

    r12852 r13105  
    111111     *
    112112     * @since 1.5.0
    113      * @since 7.0.0 Added $xprofile_query parameter. Added $user_ids parameter.
     113     * @since 7.0.0 Added `$xprofile_query` parameter. Added `$user_ids` parameter.
    114114     *
    115115     * @see BP_User_Query for an in-depth description of parameters.
    116116     *
    117      * @param array $args {
     117     * @param array ...$args {
    118118     *     Array of arguments. Supports all arguments of BP_User_Query. Additional
    119119     *     arguments, or those with different defaults, are described below.
     
    268268     * @return bool True if there are items in the loop, otherwise false.
    269269     */
    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 );
    275272    }
    276273
     
    282279     * @return object The next member to iterate over.
    283280     */
    284     function next_member() {
     281    public function next_member() {
    285282        $this->current_member++;
    286         $this->member = $this->members[$this->current_member];
     283        $this->member = $this->members[ $this->current_member ];
    287284
    288285        return $this->member;
     
    294291     * @since 1.0.0
    295292     */
    296     function rewind_members() {
     293    public function rewind_members() {
    297294        $this->current_member = -1;
    298295        if ( $this->member_count > 0 ) {
     
    314311     * @return bool True if there are more members to show, otherwise false.
    315312     */
    316     function members() {
     313    public function members() {
    317314        if ( $this->current_member + 1 < $this->member_count ) {
    318315            return true;
    319         } elseif ( $this->current_member + 1 == $this->member_count ) {
     316        } elseif ( $this->current_member + 1 === $this->member_count ) {
    320317
    321318            /**
     
    344341     * @see bp_the_member()
    345342     */
    346     function the_member() {
    347 
     343    public function the_member() {
    348344        $this->in_the_loop = true;
    349345        $this->member      = $this->next_member();
    350346
    351347        // Loop has just started.
    352         if ( 0 == $this->current_member ) {
     348        if ( 0 === $this->current_member ) {
    353349
    354350            /**
     
    359355            do_action( 'member_loop_start' );
    360356        }
    361 
    362357    }
    363358}
Note: See TracChangeset for help on using the changeset viewer.