Changeset 9936 for trunk/src/bp-activity/bp-activity-loader.php
- Timestamp:
- 06/11/2015 06:53:59 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-activity/bp-activity-loader.php
r9843 r9936 46 46 */ 47 47 public function includes( $includes = array() ) { 48 48 49 // Files to include 49 50 $includes = array( … … 90 91 91 92 // Define a slug, if necessary 92 if ( ! defined( 'BP_ACTIVITY_SLUG' ) )93 if ( ! defined( 'BP_ACTIVITY_SLUG' ) ) { 93 94 define( 'BP_ACTIVITY_SLUG', $this->id ); 95 } 94 96 95 97 // Global tables for activity component … … 136 138 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { 137 139 138 // Add 'Activity' to the main navigation139 $main_nav = array(140 'name' => _x( 'Activity', 'Profile activity screen nav', 'buddypress' ),141 'slug' => $this->slug,142 'position' => 10,143 'screen_function' => 'bp_activity_screen_my_activity',144 'default_subnav_slug' => 'just-me',145 'item_css_id' => $this->id146 );147 148 140 // Stop if there is no user displayed or logged in 149 if ( ! is_user_logged_in() && !bp_displayed_user_id() )141 if ( ! is_user_logged_in() && ! bp_displayed_user_id() ) { 150 142 return; 143 } 151 144 152 145 // Determine user to use … … 159 152 } 160 153 161 // User link 162 $activity_link = trailingslashit( $user_domain . $this->slug ); 154 $slug = bp_get_activity_slug(); 155 $activity_link = trailingslashit( $user_domain . $slug ); 156 157 // Add 'Activity' to the main navigation 158 $main_nav = array( 159 'name' => _x( 'Activity', 'Profile activity screen nav', 'buddypress' ), 160 'slug' => $slug, 161 'position' => 10, 162 'screen_function' => 'bp_activity_screen_my_activity', 163 'default_subnav_slug' => 'just-me', 164 'item_css_id' => $this->id 165 ); 163 166 164 167 // Add the subnav items to the activity nav item if we are using a theme that supports this … … 167 170 'slug' => 'just-me', 168 171 'parent_url' => $activity_link, 169 'parent_slug' => $ this->slug,172 'parent_slug' => $slug, 170 173 'screen_function' => 'bp_activity_screen_my_activity', 171 174 'position' => 10 … … 178 181 'slug' => 'mentions', 179 182 'parent_url' => $activity_link, 180 'parent_slug' => $ this->slug,183 'parent_slug' => $slug, 181 184 'screen_function' => 'bp_activity_screen_mentions', 182 185 'position' => 20, … … 191 194 'slug' => 'favorites', 192 195 'parent_url' => $activity_link, 193 'parent_slug' => $ this->slug,196 'parent_slug' => $slug, 194 197 'screen_function' => 'bp_activity_screen_favorites', 195 198 'position' => 30, … … 204 207 'slug' => bp_get_friends_slug(), 205 208 'parent_url' => $activity_link, 206 'parent_slug' => $ this->slug,209 'parent_slug' => $slug, 207 210 'screen_function' => 'bp_activity_screen_friends', 208 211 'position' => 40, … … 217 220 'slug' => bp_get_groups_slug(), 218 221 'parent_url' => $activity_link, 219 'parent_slug' => $ this->slug,222 'parent_slug' => $slug, 220 223 'screen_function' => 'bp_activity_screen_groups', 221 224 'position' => 50, … … 246 249 */ 247 250 public function setup_admin_bar( $wp_admin_nav = array() ) { 248 $bp = buddypress();249 251 250 252 // Menus for logged in user … … 252 254 253 255 // Setup the logged in user variables 254 $user_domain = bp_loggedin_user_domain(); 255 $activity_link = trailingslashit( $user_domain . $this->slug ); 256 $activity_link = trailingslashit( bp_loggedin_user_domain() . bp_get_activity_slug() ); 256 257 257 258 // Unread message count … … 259 260 $count = bp_get_total_mention_count_for_user( bp_loggedin_user_id() ); 260 261 if ( !empty( $count ) ) { 261 $title = sprintf( _x( 'Mentions <span class="count">%s</span>', 'Toolbar Mention logged in user', 'buddypress' ), number_format_i18n( $count ) );262 $title = sprintf( _x( 'Mentions <span class="count">%s</span>', 'Toolbar Mention logged in user', 'buddypress' ), bp_core_number_format( $count ) ); 262 263 } else { 263 264 $title = _x( 'Mentions', 'Toolbar Mention logged in user', 'buddypress' ); … … 267 268 // Add the "Activity" sub menu 268 269 $wp_admin_nav[] = array( 269 'parent' => $bp->my_account_menu_id,270 'parent' => buddypress()->my_account_menu_id, 270 271 'id' => 'my-account-' . $this->id, 271 272 'title' => _x( 'Activity', 'My Account Activity sub nav', 'buddypress' ), 272 'href' => trailingslashit( $activity_link )273 'href' => $activity_link 273 274 ); 274 275 … … 278 279 'id' => 'my-account-' . $this->id . '-personal', 279 280 'title' => _x( 'Personal', 'My Account Activity sub nav', 'buddypress' ), 280 'href' => trailingslashit( $activity_link )281 'href' => $activity_link 281 282 ); 282 283 … … 336 337 */ 337 338 public function setup_title() { 338 $bp = buddypress();339 339 340 340 // Adjust title based on view 341 341 if ( bp_is_activity_component() ) { 342 $bp = buddypress(); 343 342 344 if ( bp_is_my_profile() ) { 343 345 $bp->bp_options_title = _x( 'My Activity', 'Page and <title>', 'buddypress' ); … … 361 363 */ 362 364 public function setup_actions() { 365 363 366 // Spam prevention 364 367 add_action( 'bp_include', 'bp_activity_setup_akismet' );
Note: See TracChangeset
for help on using the changeset viewer.