Changeset 10322 for trunk/src/bp-members/bp-members-loader.php
- Timestamp:
- 11/02/2015 01:58:52 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-members/bp-members-loader.php
r10248 r10322 10 10 defined( 'ABSPATH' ) || exit; 11 11 12 /** 13 * Defines the BuddyPress Members Component. 14 */ 12 15 class BP_Members_Component extends BP_Component { 13 16 … … 17 20 * @see bp_register_member_type() 18 21 * 19 * @since 20 * @var 22 * @since 2.2.0 23 * @var array 21 24 */ 22 25 public $types = array(); … … 48 51 public function includes( $includes = array() ) { 49 52 50 // Always include these files 53 // Always include these files. 51 54 $includes = array( 52 55 'actions', … … 65 68 } 66 69 67 // Include these only if in admin 70 // Include these only if in admin. 68 71 if ( is_admin() ) { 69 72 $includes[] = 'admin'; … … 88 91 $bp = buddypress(); 89 92 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. 93 97 if ( !defined( 'BP_MEMBERS_SLUG' ) ) { 94 98 define( 'BP_MEMBERS_SLUG', $this->id ); 95 99 } 96 100 97 // Override any passed args 101 // Override any passed args. 98 102 $args = array( 99 103 'slug' => BP_MEMBERS_SLUG, … … 110 114 parent::setup_globals( $args ); 111 115 112 /** Logged in user ****************************************************/ 116 /** Logged in user *************************************************** 117 */ 113 118 114 119 // The core userdata of the user who is currently logged in. 115 120 $bp->loggedin_user->userdata = bp_core_get_core_userdata( bp_loggedin_user_id() ); 116 121 117 // Fetch the full name for the logged in user 122 // Fetch the full name for the logged in user. 118 123 $bp->loggedin_user->fullname = isset( $bp->loggedin_user->userdata->display_name ) ? $bp->loggedin_user->userdata->display_name : ''; 119 124 120 // Hits the DB on single WP installs so get this separately 125 // Hits the DB on single WP installs so get this separately. 121 126 $bp->loggedin_user->is_super_admin = $bp->loggedin_user->is_site_admin = is_super_admin( bp_loggedin_user_id() ); 122 127 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. 124 129 $bp->loggedin_user->domain = bp_core_get_user_domain( bp_loggedin_user_id() ); 125 130 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. 129 135 $bp->displayed_user->userdata = bp_core_get_core_userdata( bp_displayed_user_id() ); 130 136 131 // Fetch the full name displayed user 137 // Fetch the full name displayed user. 132 138 $bp->displayed_user->fullname = isset( $bp->displayed_user->userdata->display_name ) ? $bp->displayed_user->userdata->display_name : ''; 133 139 134 // The domain for the user currently being displayed 140 // The domain for the user currently being displayed. 135 141 $bp->displayed_user->domain = bp_core_get_user_domain( bp_displayed_user_id() ); 136 142 137 /** Signup ************************************************************/ 143 /** Signup *********************************************************** 144 */ 138 145 139 146 $bp->signup = new stdClass; 140 147 141 /** Profiles Fallback *************************************************/ 148 /** Profiles Fallback ************************************************ 149 */ 142 150 143 151 if ( ! bp_is_active( 'xprofile' ) ) { … … 156 164 $bp = buddypress(); 157 165 158 /** Default Profile Component *****************************************/ 166 /** Default Profile Component **************************************** 167 */ 159 168 160 169 if ( defined( 'BP_DEFAULT_COMPONENT' ) && BP_DEFAULT_COMPONENT ) { … … 168 177 } 169 178 170 /** Canonical Component Stack *****************************************/ 179 /** Canonical Component Stack **************************************** 180 */ 171 181 172 182 if ( bp_displayed_user_id() ) { … … 185 195 } 186 196 187 // Looking at the single member root/home, so assume the default 197 // Looking at the single member root/home, so assume the default. 188 198 if ( ! bp_current_component() ) { 189 199 $bp->current_component = $bp->default_component; 190 200 191 // The canonical URL will not contain the default component 201 // The canonical URL will not contain the default component. 192 202 } elseif ( bp_is_current_component( $bp->default_component ) && ! bp_current_action() ) { 193 203 unset( $bp->canonical_stack['component'] ); 194 204 } 195 205 196 // if we're on a spammer's profile page, only users with the 'bp_moderate' cap197 // 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. 198 208 // 199 209 // users without the cap trying to access a spammer's subnav page will get … … 220 230 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { 221 231 222 // Bail if XProfile component is active 232 // Bail if XProfile component is active. 223 233 if ( bp_is_active( 'xprofile' ) ) { 224 234 return; 225 235 } 226 236 227 // Don't set up navigation if there's no member 237 // Don't set up navigation if there's no member. 228 238 if ( ! is_user_logged_in() && ! bp_is_user() ) { 229 239 return; 230 240 } 231 241 232 // Determine user to use 242 // Determine user to use. 233 243 if ( bp_displayed_user_domain() ) { 234 244 $user_domain = bp_displayed_user_domain(); … … 242 252 $profile_link = trailingslashit( $user_domain . $slug ); 243 253 244 // Setup the main navigation 254 // Setup the main navigation. 245 255 $main_nav = array( 246 256 'name' => _x( 'Profile', 'Member profile main navigation', 'buddypress' ), … … 252 262 ); 253 263 254 // Setup the subnav items for the member profile 264 // Setup the subnav items for the member profile. 255 265 $sub_nav[] = array( 256 266 'name' => _x( 'View', 'Member profile view', 'buddypress' ), … … 292 302 public function setup_cache_groups() { 293 303 294 // Global groups 304 // Global groups. 295 305 wp_cache_add_global_groups( array( 296 306 'bp_last_activity',
Note: See TracChangeset
for help on using the changeset viewer.