Changeset 8439
- Timestamp:
- 05/21/2014 03:21:05 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-members/bp-members-loader.php
r8319 r8439 1 1 <?php 2 2 3 /** 3 4 * BuddyPress Member Loader … … 36 37 */ 37 38 public function includes( $includes = array() ) { 39 40 // Always include these files 38 41 $includes = array( 39 42 'actions', … … 48 51 ); 49 52 53 // Include these only if in admin 50 54 if ( is_admin() ) { 51 55 $includes[] = 'admin'; … … 70 74 $bp = buddypress(); 71 75 72 // Define a slug, if necessary 73 if ( !defined( 'BP_MEMBERS_SLUG' ) ) 76 /** Component Globals *************************************************/ 77 78 // Define a slug, as a fallback for backpat 79 if ( !defined( 'BP_MEMBERS_SLUG' ) ) { 74 80 define( 'BP_MEMBERS_SLUG', $this->id ); 75 76 $members_globals = array( 77 'slug' => BP_MEMBERS_SLUG, 78 'root_slug' => isset( $bp->pages->members->slug ) ? $bp->pages->members->slug : BP_MEMBERS_SLUG, 79 'has_directory' => true, 81 } 82 83 // Override any passed args 84 $args = array( 85 'slug' => BP_MEMBERS_SLUG, 86 'root_slug' => isset( $bp->pages->members->slug ) ? $bp->pages->members->slug : BP_MEMBERS_SLUG, 87 'has_directory' => true, 80 88 'directory_title' => _x( 'Members', 'component directory title', 'buddypress' ), 81 'global_tables' => array( 89 'search_string' => __( 'Search Members...', 'buddypress' ), 90 'global_tables' => array( 82 91 'table_name_last_activity' => bp_core_get_table_prefix() . 'bp_activity', 83 92 'table_name_signups' => bp_core_get_table_prefix() . 'signups', 84 ), 85 'search_string' => __( 'Search Members...', 'buddypress' ), 86 ); 87 88 parent::setup_globals( $members_globals ); 93 ) 94 ); 95 96 parent::setup_globals( $args ); 89 97 90 98 /** Logged in user ****************************************************/ … … 113 121 $bp->displayed_user->fullname = bp_core_get_user_displayname( bp_displayed_user_id() ); 114 122 115 /** Signup ***************************************************/ 123 /** Signup ************************************************************/ 124 116 125 $bp->signup = new stdClass; 117 126 … … 126 135 /** Default Profile Component *****************************************/ 127 136 128 if ( !defined( 'BP_DEFAULT_COMPONENT' ) ) { 137 if ( defined( 'BP_DEFAULT_COMPONENT' ) && BP_DEFAULT_COMPONENT ) { 138 $bp->default_component = BP_DEFAULT_COMPONENT; 139 } else { 129 140 if ( bp_is_active( 'activity' ) && isset( $bp->pages->activity ) ) { 130 141 $bp->default_component = bp_get_activity_slug(); … … 132 143 $bp->default_component = ( 'xprofile' === $bp->profile->id ) ? 'profile' : $bp->profile->id; 133 144 } 134 135 } else { 136 $bp->default_component = BP_DEFAULT_COMPONENT; 137 } 145 } 146 147 /** Canonical Component Stack *****************************************/ 138 148 139 149 if ( bp_displayed_user_id() ) { … … 152 162 } 153 163 154 if ( !bp_current_component() ) { 164 // Looking at the single member root/home, so assume the default 165 if ( ! bp_current_component() ) { 155 166 $bp->current_component = $bp->default_component; 156 } else if ( bp_is_current_component( $bp->default_component ) && !bp_current_action() ) { 157 // The canonical URL will not contain the default component 167 168 // The canonical URL will not contain the default component 169 } elseif ( bp_is_current_component( $bp->default_component ) && ! bp_current_action() ) { 158 170 unset( $bp->canonical_stack['component'] ); 159 171 } … … 172 184 173 185 /** 174 * Set up component navigation.186 * Set up fall-back component navigation if XProfile is inactive. 175 187 * 176 188 * @since BuddyPress (1.5.0) … … 184 196 */ 185 197 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { 198 199 // Bail if XProfile component is active 200 if ( bp_is_active( 'xprofile' ) ) { 201 return; 202 } 203 204 // Don't set up navigation if there's no member 205 if ( ! is_user_logged_in() && ! bp_is_user() ) { 206 return; 207 } 208 186 209 $bp = buddypress(); 187 210 188 // Add 'Profile' to the main navigation 189 if ( !bp_is_active( 'xprofile' ) ) { 190 191 // Don't set up navigation if there's no user 192 if ( !is_user_logged_in() && !bp_is_user() ) { 193 return; 194 } 195 196 $main_nav = array( 197 'name' => __( 'Profile', 'buddypress' ), 198 'slug' => $bp->profile->slug, 199 'position' => 20, 200 'screen_function' => 'bp_members_screen_display_profile', 201 'default_subnav_slug' => 'public', 202 'item_css_id' => $bp->profile->id 203 ); 204 205 // User links 206 $user_domain = bp_displayed_user_domain() ? bp_displayed_user_domain() : bp_loggedin_user_domain(); 207 $profile_link = trailingslashit( $user_domain . $bp->profile->slug ); 208 209 // Add the subnav items to the profile 210 $sub_nav[] = array( 211 'name' => __( 'View', 'buddypress' ), 212 'slug' => 'public', 213 'parent_url' => $profile_link, 214 'parent_slug' => $bp->profile->slug, 215 'screen_function' => 'bp_members_screen_display_profile', 216 'position' => 10 217 ); 218 219 parent::setup_nav( $main_nav, $sub_nav ); 220 } 211 // Setup the main navigation 212 $main_nav = array( 213 'name' => __( 'Profile', 'buddypress' ), 214 'slug' => $bp->profile->slug, 215 'position' => 20, 216 'screen_function' => 'bp_members_screen_display_profile', 217 'default_subnav_slug' => 'public', 218 'item_css_id' => $bp->profile->id 219 ); 220 221 // User links 222 $user_domain = bp_displayed_user_domain() ? bp_displayed_user_domain() : bp_loggedin_user_domain(); 223 $profile_link = trailingslashit( $user_domain . $bp->profile->slug ); 224 225 // Setup the subnav items for the member profile 226 $sub_nav[] = array( 227 'name' => __( 'View', 'buddypress' ), 228 'slug' => 'public', 229 'parent_url' => $profile_link, 230 'parent_slug' => $bp->profile->slug, 231 'screen_function' => 'bp_members_screen_display_profile', 232 'position' => 10 233 ); 234 235 parent::setup_nav( $main_nav, $sub_nav ); 221 236 } 222 237 … … 229 244 if ( bp_is_my_profile() ) { 230 245 $bp->bp_options_title = __( 'You', 'buddypress' ); 231 } elseif( bp_is_user() ) { 246 } elseif ( bp_is_user() ) { 247 $bp->bp_options_title = bp_get_displayed_user_fullname(); 232 248 $bp->bp_options_avatar = bp_core_fetch_avatar( array( 233 249 'item_id' => bp_displayed_user_id(), 234 250 'type' => 'thumb', 235 'alt' => sprintf( __( 'Profile picture of %s', 'buddypress' ), bp_get_displayed_user_fullname())251 'alt' => sprintf( __( 'Profile picture of %s', 'buddypress' ), $bp->bp_options_title ) 236 252 ) ); 237 $bp->bp_options_title = bp_get_displayed_user_fullname();238 253 } 239 254
Note: See TracChangeset
for help on using the changeset viewer.