Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/02/2015 01:58:52 AM (9 years ago)
Author:
tw2113
Message:

More documentation cleanup for the Members component.

See #6402.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-members/bp-members-loader.php

    r10248 r10322  
    1010defined( 'ABSPATH' ) || exit;
    1111
     12/**
     13 * Defines the BuddyPress Members Component.
     14 */
    1215class BP_Members_Component extends BP_Component {
    1316
     
    1720     * @see bp_register_member_type()
    1821     *
    19      * @since  2.2.0
    20      * @var    array
     22     * @since 2.2.0
     23     * @var array
    2124     */
    2225    public $types = array();
     
    4851    public function includes( $includes = array() ) {
    4952
    50         // Always include these files
     53        // Always include these files.
    5154        $includes = array(
    5255            'actions',
     
    6568        }
    6669
    67         // Include these only if in admin
     70        // Include these only if in admin.
    6871        if ( is_admin() ) {
    6972            $includes[] = 'admin';
     
    8891        $bp = buddypress();
    8992
    90         /** Component Globals *************************************************/
    91 
    92         // Define a slug, as a fallback for backpat
     93        /** Component Globals ************************************************
     94         */
     95
     96        // Define a slug, as a fallback for backpat.
    9397        if ( !defined( 'BP_MEMBERS_SLUG' ) ) {
    9498            define( 'BP_MEMBERS_SLUG', $this->id );
    9599        }
    96100
    97         // Override any passed args
     101        // Override any passed args.
    98102        $args = array(
    99103            'slug'            => BP_MEMBERS_SLUG,
     
    110114        parent::setup_globals( $args );
    111115
    112         /** Logged in user ****************************************************/
     116        /** Logged in user ***************************************************
     117         */
    113118
    114119        // The core userdata of the user who is currently logged in.
    115120        $bp->loggedin_user->userdata       = bp_core_get_core_userdata( bp_loggedin_user_id() );
    116121
    117         // Fetch the full name for the logged in user
     122        // Fetch the full name for the logged in user.
    118123        $bp->loggedin_user->fullname       = isset( $bp->loggedin_user->userdata->display_name ) ? $bp->loggedin_user->userdata->display_name : '';
    119124
    120         // Hits the DB on single WP installs so get this separately
     125        // Hits the DB on single WP installs so get this separately.
    121126        $bp->loggedin_user->is_super_admin = $bp->loggedin_user->is_site_admin = is_super_admin( bp_loggedin_user_id() );
    122127
    123         // The domain for the user currently logged in. eg: http://example.com/members/andy
     128        // The domain for the user currently logged in. eg: http://example.com/members/andy.
    124129        $bp->loggedin_user->domain         = bp_core_get_user_domain( bp_loggedin_user_id() );
    125130
    126         /** Displayed user ****************************************************/
    127 
    128         // The core userdata of the user who is currently being displayed
     131        /** Displayed user ***************************************************
     132         */
     133
     134        // The core userdata of the user who is currently being displayed.
    129135        $bp->displayed_user->userdata = bp_core_get_core_userdata( bp_displayed_user_id() );
    130136
    131         // Fetch the full name displayed user
     137        // Fetch the full name displayed user.
    132138        $bp->displayed_user->fullname = isset( $bp->displayed_user->userdata->display_name ) ? $bp->displayed_user->userdata->display_name : '';
    133139
    134         // The domain for the user currently being displayed
     140        // The domain for the user currently being displayed.
    135141        $bp->displayed_user->domain   = bp_core_get_user_domain( bp_displayed_user_id() );
    136142
    137         /** Signup ************************************************************/
     143        /** Signup ***********************************************************
     144         */
    138145
    139146        $bp->signup = new stdClass;
    140147
    141         /** Profiles Fallback *************************************************/
     148        /** Profiles Fallback ************************************************
     149         */
    142150
    143151        if ( ! bp_is_active( 'xprofile' ) ) {
     
    156164        $bp = buddypress();
    157165
    158         /** Default Profile Component *****************************************/
     166        /** Default Profile Component ****************************************
     167         */
    159168
    160169        if ( defined( 'BP_DEFAULT_COMPONENT' ) && BP_DEFAULT_COMPONENT ) {
     
    168177        }
    169178
    170         /** Canonical Component Stack *****************************************/
     179        /** Canonical Component Stack ****************************************
     180         */
    171181
    172182        if ( bp_displayed_user_id() ) {
     
    185195            }
    186196
    187             // Looking at the single member root/home, so assume the default
     197            // Looking at the single member root/home, so assume the default.
    188198            if ( ! bp_current_component() ) {
    189199                $bp->current_component = $bp->default_component;
    190200
    191             // The canonical URL will not contain the default component
     201            // The canonical URL will not contain the default component.
    192202            } elseif ( bp_is_current_component( $bp->default_component ) && ! bp_current_action() ) {
    193203                unset( $bp->canonical_stack['component'] );
    194204            }
    195205
    196             // if we're on a spammer's profile page, only users with the 'bp_moderate' cap
    197             // can view subpages on the spammer's profile
     206            // If we're on a spammer's profile page, only users with the 'bp_moderate' cap
     207            // can view subpages on the spammer's profile.
    198208            //
    199209            // users without the cap trying to access a spammer's subnav page will get
     
    220230    public function setup_nav( $main_nav = array(), $sub_nav = array() ) {
    221231
    222         // Bail if XProfile component is active
     232        // Bail if XProfile component is active.
    223233        if ( bp_is_active( 'xprofile' ) ) {
    224234            return;
    225235        }
    226236
    227         // Don't set up navigation if there's no member
     237        // Don't set up navigation if there's no member.
    228238        if ( ! is_user_logged_in() && ! bp_is_user() ) {
    229239            return;
    230240        }
    231241
    232         // Determine user to use
     242        // Determine user to use.
    233243        if ( bp_displayed_user_domain() ) {
    234244            $user_domain = bp_displayed_user_domain();
     
    242252        $profile_link = trailingslashit( $user_domain . $slug );
    243253
    244         // Setup the main navigation
     254        // Setup the main navigation.
    245255        $main_nav = array(
    246256            'name'                => _x( 'Profile', 'Member profile main navigation', 'buddypress' ),
     
    252262        );
    253263
    254         // Setup the subnav items for the member profile
     264        // Setup the subnav items for the member profile.
    255265        $sub_nav[] = array(
    256266            'name'            => _x( 'View', 'Member profile view', 'buddypress' ),
     
    292302    public function setup_cache_groups() {
    293303
    294         // Global groups
     304        // Global groups.
    295305        wp_cache_add_global_groups( array(
    296306            'bp_last_activity',
Note: See TracChangeset for help on using the changeset viewer.