Changeset 9936
- Timestamp:
- 06/11/2015 06:53:59 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 17 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' ); -
trunk/src/bp-blogs/bp-blogs-loader.php
r9898 r9936 144 144 */ 145 145 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { 146 $bp = buddypress();147 146 148 147 /** … … 155 154 } 156 155 157 // Add 'Sites' to the main navigation158 $count = (int) bp_get_total_blog_count_for_user();159 $class = ( 0 === $count ) ? 'no-count' : 'count';160 $nav_text = sprintf( __( 'Sites <span class="%s">%s</span>', 'buddypress' ), esc_attr( $class ), number_format_i18n( $count ) );161 $main_nav = array(162 'name' => $nav_text,163 'slug' => $this->slug,164 'position' => 30,165 'screen_function' => 'bp_blogs_screen_my_blogs',166 'default_subnav_slug' => 'my-sites',167 'item_css_id' => $this->id168 );169 170 156 // Determine user to use 171 157 if ( bp_displayed_user_domain() ) { … … 177 163 } 178 164 179 $parent_url = trailingslashit( $user_domain . bp_get_blogs_slug() ); 165 $slug = bp_get_blogs_slug(); 166 $parent_url = trailingslashit( $user_domain . $slug ); 167 168 // Add 'Sites' to the main navigation 169 $count = (int) bp_get_total_blog_count_for_user(); 170 $class = ( 0 === $count ) ? 'no-count' : 'count'; 171 $nav_text = sprintf( __( 'Sites <span class="%s">%s</span>', 'buddypress' ), esc_attr( $class ), bp_core_number_format( $count ) ); 172 $main_nav = array( 173 'name' => $nav_text, 174 'slug' => $slug, 175 'position' => 30, 176 'screen_function' => 'bp_blogs_screen_my_blogs', 177 'default_subnav_slug' => 'my-sites', 178 'item_css_id' => $this->id 179 ); 180 180 181 181 $sub_nav[] = array( … … 183 183 'slug' => 'my-sites', 184 184 'parent_url' => $parent_url, 185 'parent_slug' => $ bp->blogs->slug,185 'parent_slug' => $slug, 186 186 'screen_function' => 'bp_blogs_screen_my_blogs', 187 187 'position' => 10 … … 203 203 */ 204 204 public function setup_admin_bar( $wp_admin_nav = array() ) { 205 $bp = buddypress();206 205 207 206 /** … … 217 216 if ( is_user_logged_in() ) { 218 217 219 $blogs_link = trailingslashit( bp_loggedin_user_domain() . $this->slug ); 218 // Setup the logged in user variables 219 $blogs_link = trailingslashit( bp_loggedin_user_domain() . bp_get_blogs_slug() ); 220 220 221 221 // Add the "Sites" sub menu 222 222 $wp_admin_nav[] = array( 223 'parent' => $bp->my_account_menu_id,223 'parent' => buddypress()->my_account_menu_id, 224 224 'id' => 'my-account-' . $this->id, 225 225 'title' => __( 'Sites', 'buddypress' ), 226 'href' => trailingslashit( $blogs_link )226 'href' => $blogs_link 227 227 ); 228 228 … … 232 232 'id' => 'my-account-' . $this->id . '-my-sites', 233 233 'title' => __( 'My Sites', 'buddypress' ), 234 'href' => trailingslashit( $blogs_link )234 'href' => $blogs_link 235 235 ); 236 236 … … 253 253 */ 254 254 public function setup_title() { 255 $bp = buddypress();256 255 257 256 // Set up the component options navigation for Site 258 257 if ( bp_is_blogs_component() ) { 258 $bp = buddypress(); 259 259 260 if ( bp_is_my_profile() ) { 260 261 if ( bp_is_active( 'xprofile' ) ) { … … 300 301 */ 301 302 public function post_tracking_args( $params = null, $post_type = 0 ) { 303 302 304 /** 303 305 * Filters the post types to track for the Blogs component. -
trunk/src/bp-core/bp-core-loader.php
r9819 r9936 151 151 public function includes( $includes = array() ) { 152 152 153 if ( ! is_admin() )153 if ( ! is_admin() ) { 154 154 return; 155 } 155 156 156 157 $includes = array( … … 179 180 180 181 // Get the base database prefix 181 if ( empty( $bp->table_prefix ) ) 182 if ( empty( $bp->table_prefix ) ) { 182 183 $bp->table_prefix = bp_core_get_table_prefix(); 184 } 183 185 184 186 // The domain for the root of the site where the main blog resides 185 if ( empty( $bp->root_domain ) ) 187 if ( empty( $bp->root_domain ) ) { 186 188 $bp->root_domain = bp_core_get_root_domain(); 189 } 187 190 188 191 // Fetches all of the core BuddyPress settings in one fell swoop 189 if ( empty( $bp->site_options ) ) 192 if ( empty( $bp->site_options ) ) { 190 193 $bp->site_options = bp_core_get_root_options(); 194 } 191 195 192 196 // The names of the core WordPress pages used to display BuddyPress content 193 if ( empty( $bp->pages ) ) 197 if ( empty( $bp->pages ) ) { 194 198 $bp->pages = bp_core_get_directory_pages(); 199 } 195 200 196 201 /** Basic current user data *******************************************/ … … 261 266 262 267 /** 263 * Set up component navigation.264 *265 * @since BuddyPress (1.5.0)266 *267 * @see BP_Component::setup_nav() for a description of arguments.268 *269 * @param array $main_nav Optional. See BP_Component::setup_nav() for270 * description.271 * @param array $sub_nav Optional. See BP_Component::setup_nav() for272 * description.273 */274 public function setup_nav( $main_nav = array(), $sub_nav = array() ) {275 $bp = buddypress();276 277 // If xprofile component is disabled, revert to WordPress profile278 if ( !bp_is_active( 'xprofile' ) ) {279 280 // Fallback values if xprofile is disabled281 if ( ! isset( $bp->core->profile ) ) {282 $bp->core->profile = new stdClass;283 }284 $bp->core->profile->slug = 'profile';285 $bp->active_components[$bp->core->profile->slug] = $bp->core->profile->slug;286 287 // Add 'Profile' to the main navigation288 $main_nav = array(289 'name' => _x( 'Profile', 'Main navigation', 'buddypress' ),290 'slug' => $bp->core->profile->slug,291 'position' => 20,292 'screen_function' => 'bp_core_catch_profile_uri',293 'default_subnav_slug' => 'public'294 );295 296 $profile_link = trailingslashit( bp_loggedin_user_domain() . '/' . $bp->core->profile->slug );297 298 // Add the subnav items to the profile299 $sub_nav[] = array(300 'name' => _x( 'View', 'Profile sub nav', 'buddypress' ),301 'slug' => 'public',302 'parent_url' => $profile_link,303 'parent_slug' => $bp->core->profile->slug,304 'screen_function' => 'bp_core_catch_profile_uri'305 );306 307 parent::setup_nav( $main_nav, $sub_nav );308 }309 }310 311 /**312 268 * Setup cache groups 313 269 * -
trunk/src/bp-forums/bp-forums-loader.php
r9819 r9936 50 50 51 51 // Define the parent forum ID 52 if ( ! defined( 'BP_FORUMS_PARENT_FORUM_ID' ) )52 if ( ! defined( 'BP_FORUMS_PARENT_FORUM_ID' ) ) { 53 53 define( 'BP_FORUMS_PARENT_FORUM_ID', 1 ); 54 } 54 55 55 56 // Define a slug, if necessary 56 if ( ! defined( 'BP_FORUMS_SLUG' ) )57 if ( ! defined( 'BP_FORUMS_SLUG' ) ) { 57 58 define( 'BP_FORUMS_SLUG', $this->id ); 59 } 58 60 59 61 // The location of the bbPress stand-alone config file 60 62 $bbconfig = bp_core_get_root_option( 'bb-config-location' ); 61 if ( '' !== $bbconfig ) 63 if ( '' !== $bbconfig ) { 62 64 $this->bbconfig = $bbconfig; 65 } 63 66 64 67 // All globals for messaging component. … … 95 98 96 99 // bbPress stand-alone 97 if ( ! defined( 'BB_PATH' ) )100 if ( ! defined( 'BB_PATH' ) ) { 98 101 $includes[] = 'bbpress-sa'; 102 } 99 103 100 104 // Admin-specific code … … 122 126 123 127 // Stop if forums haven't been set up yet 124 if ( ! bp_forums_is_installed_correctly() )128 if ( ! bp_forums_is_installed_correctly() ) { 125 129 return; 130 } 126 131 127 132 // Stop if there is no user displayed or logged in 128 if ( ! is_user_logged_in() && !bp_displayed_user_id() )133 if ( ! is_user_logged_in() && ! bp_displayed_user_id() ) { 129 134 return; 130 131 // Add 'Forums' to the main navigation 132 $main_nav = array( 133 'name' => __( 'Forums', 'buddypress' ), 134 'slug' => $this->slug, 135 'position' => 80, 136 'screen_function' => 'bp_member_forums_screen_topics', 137 'default_subnav_slug' => 'topics', 138 'item_css_id' => $this->id 139 ); 135 } 140 136 141 137 // Determine user to use … … 149 145 150 146 // User link 151 $forums_link = trailingslashit( $user_domain . $this->slug ); 152 153 // Additional menu if friends is active 147 $slug = bp_get_forums_slug(); 148 $forums_link = trailingslashit( $user_domain . $slug ); 149 150 // Add 'Forums' to the main navigation 151 $main_nav = array( 152 'name' => __( 'Forums', 'buddypress' ), 153 'slug' => $slug, 154 'position' => 80, 155 'screen_function' => 'bp_member_forums_screen_topics', 156 'default_subnav_slug' => 'topics', 157 'item_css_id' => $this->id 158 ); 159 160 // Topics started 154 161 $sub_nav[] = array( 155 162 'name' => __( 'Topics Started', 'buddypress' ), 156 163 'slug' => 'topics', 157 164 'parent_url' => $forums_link, 158 'parent_slug' => $ this->slug,165 'parent_slug' => $slug, 159 166 'screen_function' => 'bp_member_forums_screen_topics', 160 167 'position' => 20, … … 162 169 ); 163 170 164 // Additional menu if friends is active171 // Topics replied to 165 172 $sub_nav[] = array( 166 173 'name' => __( 'Replied To', 'buddypress' ), 167 174 'slug' => 'replies', 168 175 'parent_url' => $forums_link, 169 'parent_slug' => $ this->slug,176 'parent_slug' => $slug, 170 177 'screen_function' => 'bp_member_forums_screen_replies', 171 178 'position' => 40, … … 192 199 193 200 // Setup the logged in user variables 194 $forums_link = trailingslashit( bp_loggedin_user_domain() . $this->slug);201 $forums_link = trailingslashit( bp_loggedin_user_domain() . bp_get_forums_slug() ); 195 202 196 203 // Add the "My Account" sub menus … … 199 206 'id' => 'my-account-' . $this->id, 200 207 'title' => __( 'Forums', 'buddypress' ), 201 'href' => trailingslashit( $forums_link )208 'href' => $forums_link 202 209 ); 203 210 … … 207 214 'id' => 'my-account-' . $this->id . '-topics-started', 208 215 'title' => __( 'Topics Started', 'buddypress' ), 209 'href' => trailingslashit( $forums_link . 'topics' )216 'href' => $forums_link 210 217 ); 211 218 … … 234 241 */ 235 242 public function setup_title() { 236 $bp = buddypress();237 243 238 244 // Adjust title based on view 239 245 if ( bp_is_forums_component() ) { 246 $bp = buddypress(); 247 240 248 if ( bp_is_my_profile() ) { 241 249 $bp->bp_options_title = __( 'Forums', 'buddypress' ); -
trunk/src/bp-friends/bp-friends-loader.php
r9819 r9936 76 76 77 77 // Define a slug, if necessary 78 if ( ! defined( 'BP_FRIENDS_SLUG' ) )78 if ( ! defined( 'BP_FRIENDS_SLUG' ) ) { 79 79 define( 'BP_FRIENDS_SLUG', $this->id ); 80 } 80 81 81 82 // Global tables for the friends component … … 111 112 */ 112 113 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { 113 $bp = buddypress();114 115 // Add 'Friends' to the main navigation116 $count = friends_get_total_friend_count();117 $class = ( 0 === $count ) ? 'no-count' : 'count';118 $main_nav = array(119 'name' => sprintf( __( 'Friends <span class="%s">%s</span>', 'buddypress' ), esc_attr( $class ), number_format_i18n( $count ) ),120 'slug' => $this->slug,121 'position' => 60,122 'screen_function' => 'friends_screen_my_friends',123 'default_subnav_slug' => 'my-friends',124 'item_css_id' => $bp->friends->id125 );126 114 127 115 // Determine user to use … … 134 122 } 135 123 136 $friends_link = trailingslashit( $user_domain . bp_get_friends_slug() ); 124 $access = bp_core_can_edit_settings(); 125 $slug = bp_get_friends_slug(); 126 $friends_link = trailingslashit( $user_domain . $slug ); 127 128 // Add 'Friends' to the main navigation 129 $count = friends_get_total_friend_count(); 130 $class = ( 0 === $count ) ? 'no-count' : 'count'; 131 $main_nav = array( 132 'name' => sprintf( __( 'Friends <span class="%s">%s</span>', 'buddypress' ), esc_attr( $class ), bp_core_number_format( $count ) ), 133 'slug' => $slug, 134 'position' => 60, 135 'screen_function' => 'friends_screen_my_friends', 136 'default_subnav_slug' => 'my-friends', 137 'item_css_id' => $this->id 138 ); 137 139 138 140 // Add the subnav items to the friends nav item … … 141 143 'slug' => 'my-friends', 142 144 'parent_url' => $friends_link, 143 'parent_slug' => bp_get_friends_slug(),145 'parent_slug' => $slug, 144 146 'screen_function' => 'friends_screen_my_friends', 145 147 'position' => 10, … … 151 153 'slug' => 'requests', 152 154 'parent_url' => $friends_link, 153 'parent_slug' => bp_get_friends_slug(),155 'parent_slug' => $slug, 154 156 'screen_function' => 'friends_screen_requests', 155 157 'position' => 20, 156 'user_has_access' => bp_core_can_edit_settings()158 'user_has_access' => $access 157 159 ); 158 160 … … 171 173 */ 172 174 public function setup_admin_bar( $wp_admin_nav = array() ) { 173 $bp = buddypress();174 175 175 176 // Menus for logged in user … … 177 178 178 179 // Setup the logged in user variables 179 $user_domain = bp_loggedin_user_domain(); 180 $friends_link = trailingslashit( $user_domain . $this->slug ); 180 $friends_link = trailingslashit( bp_loggedin_user_domain() . bp_get_friends_slug() ); 181 181 182 182 // Pending friend requests 183 183 $count = count( friends_get_friendship_request_user_ids( bp_loggedin_user_id() ) ); 184 184 if ( !empty( $count ) ) { 185 $title = sprintf( _x( 'Friends <span class="count">%s</span>', 'My Account Friends menu', 'buddypress' ), number_format_i18n( $count ) );186 $pending = sprintf( _x( 'Pending Requests <span class="count">%s</span>', 'My Account Friends menu sub nav', 'buddypress' ), number_format_i18n( $count ) );185 $title = sprintf( _x( 'Friends <span class="count">%s</span>', 'My Account Friends menu', 'buddypress' ), bp_core_number_format( $count ) ); 186 $pending = sprintf( _x( 'Pending Requests <span class="count">%s</span>', 'My Account Friends menu sub nav', 'buddypress' ), bp_core_number_format( $count ) ); 187 187 } else { 188 $title = _x( 'Friends', 'My Account Friends menu','buddypress' );188 $title = _x( 'Friends', 'My Account Friends menu', 'buddypress' ); 189 189 $pending = _x( 'No Pending Requests','My Account Friends menu sub nav', 'buddypress' ); 190 190 } … … 192 192 // Add the "My Account" sub menus 193 193 $wp_admin_nav[] = array( 194 'parent' => $bp->my_account_menu_id,194 'parent' => buddypress()->my_account_menu_id, 195 195 'id' => 'my-account-' . $this->id, 196 196 'title' => $title, 197 'href' => trailingslashit( $friends_link )197 'href' => $friends_link 198 198 ); 199 199 … … 203 203 'id' => 'my-account-' . $this->id . '-friendships', 204 204 'title' => _x( 'Friendships', 'My Account Friends menu sub nav', 'buddypress' ), 205 'href' => trailingslashit( $friends_link )205 'href' => $friends_link 206 206 ); 207 207 … … 222 222 */ 223 223 public function setup_title() { 224 $bp = buddypress();225 224 226 225 // Adjust title 227 226 if ( bp_is_friends_component() ) { 227 $bp = buddypress(); 228 228 229 if ( bp_is_my_profile() ) { 229 230 $bp->bp_options_title = __( 'Friendships', 'buddypress' ); -
trunk/src/bp-groups/bp-groups-loader.php
r9906 r9936 121 121 ); 122 122 123 if ( is_admin() ) 123 if ( is_admin() ) { 124 124 $includes[] = 'admin'; 125 } 125 126 126 127 parent::includes( $includes ); … … 143 144 144 145 // Define a slug, if necessary 145 if ( ! defined( 'BP_GROUPS_SLUG' ) )146 if ( ! defined( 'BP_GROUPS_SLUG' ) ) { 146 147 define( 'BP_GROUPS_SLUG', $this->id ); 148 } 147 149 148 150 // Global tables for groups component … … 214 216 215 217 // Using "item" not "group" for generic support in other components. 216 if ( bp_current_user_can( 'bp_moderate' ) ) 218 if ( bp_current_user_can( 'bp_moderate' ) ) { 217 219 bp_update_is_item_admin( true, 'groups' ); 218 else220 } else { 219 221 bp_update_is_item_admin( groups_is_user_admin( bp_loggedin_user_id(), $this->current_group->id ), 'groups' ); 222 } 220 223 221 224 // If the user is not an admin, check if they are a moderator 222 if ( ! bp_is_item_admin() )225 if ( ! bp_is_item_admin() ) { 223 226 bp_update_is_item_mod ( groups_is_user_mod ( bp_loggedin_user_id(), $this->current_group->id ), 'groups' ); 227 } 224 228 225 229 // Is the logged in user a member of the group? 226 if ( ( is_user_logged_in() && groups_is_user_member( bp_loggedin_user_id(), $this->current_group->id ) ) ) 230 if ( ( is_user_logged_in() && groups_is_user_member( bp_loggedin_user_id(), $this->current_group->id ) ) ) { 227 231 $this->current_group->is_user_member = true; 228 else232 } else { 229 233 $this->current_group->is_user_member = false; 234 } 230 235 231 236 // Should this group be visible to the logged in user? 232 if ( 'public' == $this->current_group->status || $this->current_group->is_user_member ) 237 if ( 'public' == $this->current_group->status || $this->current_group->is_user_member ) { 233 238 $this->current_group->is_visible = true; 234 else239 } else { 235 240 $this->current_group->is_visible = false; 241 } 236 242 237 243 // If this is a private or hidden group, does the user have access? 238 244 if ( 'private' == $this->current_group->status || 'hidden' == $this->current_group->status ) { 239 if ( $this->current_group->is_user_member && is_user_logged_in() || bp_current_user_can( 'bp_moderate' ) ) 245 if ( $this->current_group->is_user_member && is_user_logged_in() || bp_current_user_can( 'bp_moderate' ) ) { 240 246 $this->current_group->user_has_access = true; 241 else247 } else { 242 248 $this->current_group->user_has_access = false; 249 } 243 250 } else { 244 251 $this->current_group->user_has_access = true; … … 346 353 } 347 354 348 349 355 /** 350 356 * Filters the default groups extension. … … 357 363 $this->default_extension = apply_filters( 'bp_groups_default_extension', defined( 'BP_GROUPS_DEFAULT_EXTENSION' ) ? BP_GROUPS_DEFAULT_EXTENSION : 'home' ); 358 364 359 if ( !bp_current_action() ) { 360 buddypress()->current_action = $this->default_extension; 365 $bp = buddypress(); 366 367 if ( ! bp_current_action() ) { 368 $bp->current_action = $this->default_extension; 361 369 } 362 370 363 371 // Prepare for a redirect to the canonical URL 364 buddypress()->canonical_stack['base_url'] = bp_get_group_permalink( $this->current_group );372 $bp->canonical_stack['base_url'] = bp_get_group_permalink( $this->current_group ); 365 373 366 374 if ( bp_current_action() ) { 367 buddypress()->canonical_stack['action'] = bp_current_action();368 } 369 370 if ( ! empty( buddypress()->action_variables ) ) {371 buddypress()->canonical_stack['action_variables'] = bp_action_variables();375 $bp->canonical_stack['action'] = bp_current_action(); 376 } 377 378 if ( ! empty( $bp->action_variables ) ) { 379 $bp->canonical_stack['action_variables'] = bp_action_variables(); 372 380 } 373 381 … … 375 383 // that extension's slug, unless more has been tacked onto the URL via 376 384 // action variables 377 if ( bp_is_current_action( $this->default_extension ) && empty( buddypress()->action_variables ) ) {378 unset( buddypress()->canonical_stack['action'] );385 if ( bp_is_current_action( $this->default_extension ) && empty( $bp->action_variables ) ) { 386 unset( $bp->canonical_stack['action'] ); 379 387 } 380 388 } … … 391 399 */ 392 400 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { 393 394 // Only grab count if we're on a user page395 if ( bp_is_user() ) {396 $count = bp_get_total_group_count_for_user();397 $class = ( 0 === $count ) ? 'no-count' : 'count';398 $nav_name = sprintf( _x( 'Groups <span class="%s">%s</span>', 'Group screen nav with counter', 'buddypress' ), esc_attr( $class ), number_format_i18n( $count ) );399 } else {400 $nav_name = _x( 'Groups', 'Group screen nav without counter', 'buddypress' );401 }402 403 // Add 'Groups' to the main navigation404 $main_nav = array(405 'name' => $nav_name,406 'slug' => $this->slug,407 'position' => 70,408 'screen_function' => 'groups_screen_my_groups',409 'default_subnav_slug' => 'my-groups',410 'item_css_id' => $this->id411 );412 401 413 402 // Determine user to use … … 420 409 } 421 410 422 if ( !empty( $user_domain ) ) { 423 $groups_link = trailingslashit( $user_domain . $this->slug ); 411 // Only grab count if we're on a user page 412 if ( bp_is_user() ) { 413 $count = bp_get_total_group_count_for_user(); 414 $class = ( 0 === $count ) ? 'no-count' : 'count'; 415 $nav_name = sprintf( _x( 'Groups <span class="%s">%s</span>', 'Group screen nav with counter', 'buddypress' ), esc_attr( $class ), bp_core_number_format( $count ) ); 416 } else { 417 $nav_name = _x( 'Groups', 'Group screen nav without counter', 'buddypress' ); 418 } 419 420 $slug = bp_get_groups_slug(); 421 422 // Add 'Groups' to the main navigation 423 $main_nav = array( 424 'name' => $nav_name, 425 'slug' => $slug, 426 'position' => 70, 427 'screen_function' => 'groups_screen_my_groups', 428 'default_subnav_slug' => 'my-groups', 429 'item_css_id' => $this->id 430 ); 431 432 if ( ! empty( $user_domain ) ) { 433 $access = bp_core_can_edit_settings(); 434 $groups_link = trailingslashit( $user_domain . $slug ); 424 435 425 436 // Add the My Groups nav item … … 428 439 'slug' => 'my-groups', 429 440 'parent_url' => $groups_link, 430 'parent_slug' => $ this->slug,441 'parent_slug' => $slug, 431 442 'screen_function' => 'groups_screen_my_groups', 432 443 'position' => 10, … … 439 450 'slug' => 'invites', 440 451 'parent_url' => $groups_link, 441 'parent_slug' => $ this->slug,452 'parent_slug' => $slug, 442 453 'screen_function' => 'groups_screen_group_invites', 443 'user_has_access' => bp_core_can_edit_settings(),454 'user_has_access' => $access, 444 455 'position' => 30 445 456 ); … … 487 498 488 499 $sub_nav[] = array( 489 'name' 490 'slug' 491 'parent_url' 492 'parent_slug' 493 'screen_function' 494 'position' 500 'name' => _x( 'Request Membership','Group screen nav', 'buddypress' ), 501 'slug' => 'request-membership', 502 'parent_url' => $group_link, 503 'parent_slug' => $this->current_group->slug, 504 'screen_function' => 'groups_screen_group_request_membership', 505 'position' => 30 495 506 ); 496 507 } … … 562 573 563 574 $sub_nav[] = array_merge( array( 564 'name' 565 'slug' 566 'position' 575 'name' => __( 'Details', 'buddypress' ), 576 'slug' => 'edit-details', 577 'position' => 0, 567 578 ), $default_params ); 568 579 569 580 $sub_nav[] = array_merge( array( 570 'name' 571 'slug' 572 'position' 581 'name' => __( 'Settings', 'buddypress' ), 582 'slug' => 'group-settings', 583 'position' => 10, 573 584 ), $default_params ); 574 585 575 586 if ( ! bp_disable_group_avatar_uploads() && buddypress()->avatar->show_avatars ) { 576 587 $sub_nav[] = array_merge( array( 577 'name' 578 'slug' 579 'position' 588 'name' => __( 'Photo', 'buddypress' ), 589 'slug' => 'group-avatar', 590 'position' => 20, 580 591 ), $default_params ); 581 592 } 582 593 583 594 $sub_nav[] = array_merge( array( 584 'name' 585 'slug' 586 'position' 595 'name' => __( 'Members', 'buddypress' ), 596 'slug' => 'manage-members', 597 'position' => 30, 587 598 ), $default_params ); 588 599 589 600 if ( 'private' == $this->current_group->status ) { 590 601 $sub_nav[] = array_merge( array( 591 'name' 592 'slug' 593 'position' 602 'name' => __( 'Requests', 'buddypress' ), 603 'slug' => 'membership-requests', 604 'position' => 40, 594 605 ), $default_params ); 595 606 } 596 607 597 608 $sub_nav[] = array_merge( array( 598 'name' 599 'slug' 600 'position' 609 'name' => __( 'Delete', 'buddypress' ), 610 'slug' => 'delete-group', 611 'position' => 1000, 601 612 ), $default_params ); 602 613 } … … 631 642 */ 632 643 public function setup_admin_bar( $wp_admin_nav = array() ) { 633 $bp = buddypress();634 644 635 645 // Menus for logged in user … … 637 647 638 648 // Setup the logged in user variables 639 $user_domain = bp_loggedin_user_domain(); 640 $groups_link = trailingslashit( $user_domain . $this->slug ); 649 $groups_link = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ); 641 650 642 651 // Pending group invites … … 645 654 $pending = _x( 'No Pending Invites', 'My Account Groups sub nav', 'buddypress' ); 646 655 647 if ( ! empty( $count['total'] ) ) {648 $title = sprintf( _x( 'Groups <span class="count">%s</span>', 'My Account Groups nav', 'buddypress' ), $count);649 $pending = sprintf( _x( 'Pending Invites <span class="count">%s</span>', 'My Account Groups sub nav', 'buddypress' ), $count);656 if ( ! empty( $count['total'] ) ) { 657 $title = sprintf( _x( 'Groups <span class="count">%s</span>', 'My Account Groups nav', 'buddypress' ), bp_core_number_format( $count ) ); 658 $pending = sprintf( _x( 'Pending Invites <span class="count">%s</span>', 'My Account Groups sub nav', 'buddypress' ), bp_core_number_format( $count ) ); 650 659 } 651 660 652 661 // Add the "My Account" sub menus 653 662 $wp_admin_nav[] = array( 654 'parent' => $bp->my_account_menu_id,663 'parent' => buddypress()->my_account_menu_id, 655 664 'id' => 'my-account-' . $this->id, 656 665 'title' => $title, 657 'href' => trailingslashit( $groups_link )666 'href' => $groups_link 658 667 ); 659 668 … … 663 672 'id' => 'my-account-' . $this->id . '-memberships', 664 673 'title' => _x( 'Memberships', 'My Account Groups sub nav', 'buddypress' ), 665 'href' => trailingslashit( $groups_link )674 'href' => $groups_link 666 675 ); 667 676 … … 692 701 */ 693 702 public function setup_title() { 694 $bp = buddypress();695 703 696 704 if ( bp_is_groups_component() ) { 705 $bp = buddypress(); 697 706 698 707 if ( bp_is_my_profile() && !bp_is_single_item() ) { -
trunk/src/bp-members/bp-members-filters.php
r9877 r9936 111 111 // If xprofile is active, use profile domain link 112 112 if ( ! is_admin() && bp_is_active( 'xprofile' ) ) { 113 $profile_link = trailingslashit( bp_core_get_user_domain( $user_id ) . b uddypress()->profile->slug. '/edit' );113 $profile_link = trailingslashit( bp_core_get_user_domain( $user_id ) . bp_get_profile_slug() . '/edit' ); 114 114 115 115 // Default to $url -
trunk/src/bp-members/bp-members-loader.php
r9877 r9936 142 142 /** Profiles Fallback *************************************************/ 143 143 144 if ( ! bp_is_active( 'xprofile' ) ) {144 if ( ! bp_is_active( 'xprofile' ) ) { 145 145 $bp->profile = new stdClass; 146 146 $bp->profile->slug = 'profile'; … … 231 231 } 232 232 233 $bp = buddypress(); 233 // Determine user to use 234 if ( bp_displayed_user_domain() ) { 235 $user_domain = bp_displayed_user_domain(); 236 } elseif ( bp_loggedin_user_domain() ) { 237 $user_domain = bp_loggedin_user_domain(); 238 } else { 239 return; 240 } 241 242 $slug = bp_get_profile_slug(); 243 $profile_link = trailingslashit( $user_domain . $slug ); 234 244 235 245 // Setup the main navigation 236 246 $main_nav = array( 237 247 'name' => _x( 'Profile', 'Member profile main navigation', 'buddypress' ), 238 'slug' => $ bp->profile->slug,248 'slug' => $slug, 239 249 'position' => 20, 240 250 'screen_function' => 'bp_members_screen_display_profile', 241 251 'default_subnav_slug' => 'public', 242 'item_css_id' => $bp->profile->id 243 ); 244 245 // User links 246 $user_domain = bp_displayed_user_domain() ? bp_displayed_user_domain() : bp_loggedin_user_domain(); 247 $profile_link = trailingslashit( $user_domain . $bp->profile->slug ); 252 'item_css_id' => buddypress()->profile->id 253 ); 248 254 249 255 // Setup the subnav items for the member profile … … 252 258 'slug' => 'public', 253 259 'parent_url' => $profile_link, 254 'parent_slug' => $ bp->profile->slug,260 'parent_slug' => $slug, 255 261 'screen_function' => 'bp_members_screen_display_profile', 256 262 'position' => 10 -
trunk/src/bp-messages/bp-messages-loader.php
r9934 r9936 91 91 92 92 // Define a slug, if necessary 93 if ( ! defined( 'BP_MESSAGES_SLUG' ) ) {93 if ( ! defined( 'BP_MESSAGES_SLUG' ) ) { 94 94 define( 'BP_MESSAGES_SLUG', $this->id ); 95 95 } … … 130 130 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { 131 131 132 // Only grab count if we're on a user page and current user has access133 if ( bp_is_user() && bp_user_has_access() ) {134 $count = bp_get_total_unread_messages_count();135 $class = ( 0 === $count ) ? 'no-count' : 'count';136 $nav_name = sprintf( __( 'Messages <span class="%s">%s</span>', 'buddypress' ), esc_attr( $class ), number_format_i18n( $count ) );137 } else {138 $nav_name = __( 'Messages', 'buddypress' );139 }140 141 // Add 'Messages' to the main navigation142 $main_nav = array(143 'name' => $nav_name,144 'slug' => $this->slug,145 'position' => 50,146 'show_for_displayed_user' => bp_core_can_edit_settings(),147 'screen_function' => 'messages_screen_inbox',148 'default_subnav_slug' => 'inbox',149 'item_css_id' => $this->id150 );151 152 132 // Determine user to use 153 133 if ( bp_displayed_user_domain() ) { … … 159 139 } 160 140 161 // Link to user messages 162 $messages_link = trailingslashit( $user_domain . $this->slug ); 141 $access = bp_core_can_edit_settings(); 142 $slug = bp_get_messages_slug(); 143 $messages_link = trailingslashit( $user_domain . $slug ); 144 145 // Only grab count if we're on a user page and current user has access 146 if ( bp_is_user() && bp_user_has_access() ) { 147 $count = bp_get_total_unread_messages_count(); 148 $class = ( 0 === $count ) ? 'no-count' : 'count'; 149 $nav_name = sprintf( __( 'Messages <span class="%s">%s</span>', 'buddypress' ), esc_attr( $class ), bp_core_number_format( $count ) ); 150 } else { 151 $nav_name = __( 'Messages', 'buddypress' ); 152 } 153 154 // Add 'Messages' to the main navigation 155 $main_nav = array( 156 'name' => $nav_name, 157 'slug' => $slug, 158 'position' => 50, 159 'show_for_displayed_user' => $access, 160 'screen_function' => 'messages_screen_inbox', 161 'default_subnav_slug' => 'inbox', 162 'item_css_id' => $this->id 163 ); 163 164 164 165 // Add the subnav items to the profile … … 167 168 'slug' => 'inbox', 168 169 'parent_url' => $messages_link, 169 'parent_slug' => $ this->slug,170 'parent_slug' => $slug, 170 171 'screen_function' => 'messages_screen_inbox', 171 172 'position' => 10, 172 'user_has_access' => bp_core_can_edit_settings()173 'user_has_access' => $access 173 174 ); 174 175 … … 178 179 'slug' => bp_get_messages_starred_slug(), 179 180 'parent_url' => $messages_link, 180 'parent_slug' => $ this->slug,181 'parent_slug' => $slug, 181 182 'screen_function' => 'bp_messages_star_screen', 182 183 'position' => 11, 183 'user_has_access' => bp_core_can_edit_settings()184 'user_has_access' => $access 184 185 ); 185 186 } … … 189 190 'slug' => 'sentbox', 190 191 'parent_url' => $messages_link, 191 'parent_slug' => $ this->slug,192 'parent_slug' => $slug, 192 193 'screen_function' => 'messages_screen_sentbox', 193 194 'position' => 20, 194 'user_has_access' => bp_core_can_edit_settings()195 'user_has_access' => $access 195 196 ); 196 197 … … 199 200 'slug' => 'compose', 200 201 'parent_url' => $messages_link, 201 'parent_slug' => $ this->slug,202 'parent_slug' => $slug, 202 203 'screen_function' => 'messages_screen_compose', 203 204 'position' => 30, 204 'user_has_access' => bp_core_can_edit_settings()205 'user_has_access' => $access 205 206 ); 206 207 … … 210 211 'slug' => 'notices', 211 212 'parent_url' => $messages_link, 212 'parent_slug' => $ this->slug,213 'parent_slug' => $slug, 213 214 'screen_function' => 'messages_screen_notices', 214 215 'position' => 90, 215 'user_has_access' => bp_current_user_can( 'bp_moderate' )216 'user_has_access' => true 216 217 ); 217 218 } … … 227 228 */ 228 229 public function setup_admin_bar( $wp_admin_nav = array() ) { 229 $bp = buddypress();230 230 231 231 // Menus for logged in user … … 233 233 234 234 // Setup the logged in user variables 235 $user_domain = bp_loggedin_user_domain(); 236 $messages_link = trailingslashit( $user_domain . $this->slug ); 235 $messages_link = trailingslashit( bp_loggedin_user_domain() . bp_get_messages_slug() ); 237 236 238 237 // Unread message count 239 238 $count = messages_get_unread_count(); 240 239 if ( !empty( $count ) ) { 241 $title = sprintf( __( 'Messages <span class="count">%s</span>', 'buddypress' ), number_format_i18n( $count ) );242 $inbox = sprintf( __( 'Inbox <span class="count">%s</span>', 'buddypress' ), number_format_i18n( $count ) );240 $title = sprintf( __( 'Messages <span class="count">%s</span>', 'buddypress' ), bp_core_number_format( $count ) ); 241 $inbox = sprintf( __( 'Inbox <span class="count">%s</span>', 'buddypress' ), bp_core_number_format( $count ) ); 243 242 } else { 244 243 $title = __( 'Messages', 'buddypress' ); … … 248 247 // Add main Messages menu 249 248 $wp_admin_nav[] = array( 250 'parent' => $bp->my_account_menu_id,249 'parent' => buddypress()->my_account_menu_id, 251 250 'id' => 'my-account-' . $this->id, 252 251 'title' => $title, 253 'href' => trailingslashit( $messages_link )252 'href' => $messages_link 254 253 ); 255 254 … … 259 258 'id' => 'my-account-' . $this->id . '-inbox', 260 259 'title' => $inbox, 261 'href' => trailingslashit( $messages_link . 'inbox' )260 'href' => $messages_link 262 261 ); 263 262 … … 306 305 */ 307 306 public function setup_title() { 308 $bp = buddypress();309 307 310 308 if ( bp_is_messages_component() ) { 309 $bp = buddypress(); 310 311 311 if ( bp_is_my_profile() ) { 312 312 $bp->bp_options_title = __( 'My Messages', 'buddypress' ); -
trunk/src/bp-notifications/bp-notifications-loader.php
r9819 r9936 68 68 69 69 // Define a slug, if necessary 70 if ( ! defined( 'BP_NOTIFICATIONS_SLUG' ) ) {70 if ( ! defined( 'BP_NOTIFICATIONS_SLUG' ) ) { 71 71 define( 'BP_NOTIFICATIONS_SLUG', $this->id ); 72 72 } … … 104 104 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { 105 105 106 // Only grab count if we're on a user page and current user has access107 if ( bp_is_user() && bp_user_has_access() ) {108 $count = bp_notifications_get_unread_notification_count( bp_displayed_user_id() );109 $class = ( 0 === $count ) ? 'no-count' : 'count';110 $nav_name = sprintf( _x( 'Notifications <span class="%s">%s</span>', 'Profile screen nav', 'buddypress' ), esc_attr( $class ), number_format_i18n( $count ) );111 } else {112 $nav_name = _x( 'Notifications', 'Profile screen nav', 'buddypress' );113 }114 115 // Add 'Notifications' to the main navigation116 $main_nav = array(117 'name' => $nav_name,118 'slug' => $this->slug,119 'position' => 30,120 'show_for_displayed_user' => bp_core_can_edit_settings(),121 'screen_function' => 'bp_notifications_screen_unread',122 'default_subnav_slug' => 'unread',123 'item_css_id' => $this->id,124 );125 126 106 // Determine user to use 127 107 if ( bp_displayed_user_domain() ) { … … 133 113 } 134 114 135 $notifications_link = trailingslashit( $user_domain . bp_get_notifications_slug() ); 115 $access = bp_core_can_edit_settings(); 116 $slug = bp_get_notifications_slug(); 117 $notifications_link = trailingslashit( $user_domain . $slug ); 118 119 // Only grab count if we're on a user page and current user has access 120 if ( bp_is_user() && bp_user_has_access() ) { 121 $count = bp_notifications_get_unread_notification_count( bp_displayed_user_id() ); 122 $class = ( 0 === $count ) ? 'no-count' : 'count'; 123 $nav_name = sprintf( _x( 'Notifications <span class="%s">%s</span>', 'Profile screen nav', 'buddypress' ), esc_attr( $class ), bp_core_number_format( $count ) ); 124 } else { 125 $nav_name = _x( 'Notifications', 'Profile screen nav', 'buddypress' ); 126 } 127 128 // Add 'Notifications' to the main navigation 129 $main_nav = array( 130 'name' => $nav_name, 131 'slug' => $slug, 132 'position' => 30, 133 'show_for_displayed_user' => $access, 134 'screen_function' => 'bp_notifications_screen_unread', 135 'default_subnav_slug' => 'unread', 136 'item_css_id' => $this->id, 137 ); 136 138 137 139 // Add the subnav items to the notifications nav item … … 140 142 'slug' => 'unread', 141 143 'parent_url' => $notifications_link, 142 'parent_slug' => bp_get_notifications_slug(),144 'parent_slug' => $slug, 143 145 'screen_function' => 'bp_notifications_screen_unread', 144 146 'position' => 10, 145 147 'item_css_id' => 'notifications-my-notifications', 146 'user_has_access' => bp_core_can_edit_settings(),148 'user_has_access' => $access, 147 149 ); 148 150 … … 151 153 'slug' => 'read', 152 154 'parent_url' => $notifications_link, 153 'parent_slug' => bp_get_notifications_slug(),155 'parent_slug' => $slug, 154 156 'screen_function' => 'bp_notifications_screen_read', 155 157 'position' => 20, 156 'user_has_access' => bp_core_can_edit_settings(),158 'user_has_access' => $access, 157 159 ); 158 160 … … 177 179 178 180 // Setup the logged in user variables 179 $notifications_link = trailingslashit( bp_loggedin_user_domain() . $this->slug);181 $notifications_link = trailingslashit( bp_loggedin_user_domain() . bp_get_notifications_slug() ); 180 182 181 183 // Pending notification requests 182 184 $count = bp_notifications_get_unread_notification_count( bp_loggedin_user_id() ); 183 185 if ( ! empty( $count ) ) { 184 $title = sprintf( _x( 'Notifications <span class="count">%s</span>', 'My Account Notification pending', 'buddypress' ), number_format_i18n( $count ) );185 $unread = sprintf( _x( 'Unread <span class="count">%s</span>', 'My Account Notification pending', 'buddypress' ), number_format_i18n( $count ) );186 $title = sprintf( _x( 'Notifications <span class="count">%s</span>', 'My Account Notification pending', 'buddypress' ), bp_core_number_format( $count ) ); 187 $unread = sprintf( _x( 'Unread <span class="count">%s</span>', 'My Account Notification pending', 'buddypress' ), bp_core_number_format( $count ) ); 186 188 } else { 187 $title = _x( 'Notifications', 'My Account Notification', 'buddypress' );188 $unread = _x( 'Unread', 'My Account Notification sub nav', 'buddypress' );189 $title = _x( 'Notifications', 'My Account Notification', 'buddypress' ); 190 $unread = _x( 'Unread', 'My Account Notification sub nav', 'buddypress' ); 189 191 } 190 192 … … 194 196 'id' => 'my-account-' . $this->id, 195 197 'title' => $title, 196 'href' => trailingslashit( $notifications_link ),198 'href' => $notifications_link 197 199 ); 198 200 … … 202 204 'id' => 'my-account-' . $this->id . '-unread', 203 205 'title' => $unread, 204 'href' => trailingslashit( $notifications_link ),206 'href' => $notifications_link 205 207 ); 206 208 … … 223 225 */ 224 226 public function setup_title() { 225 $bp = buddypress();226 227 227 228 // Adjust title 228 229 if ( bp_is_notifications_component() ) { 230 $bp = buddypress(); 231 229 232 if ( bp_is_my_profile() ) { 230 233 $bp->bp_options_title = __( 'Notifications', 'buddypress' ); -
trunk/src/bp-settings/bp-settings-loader.php
r9819 r9936 31 31 /** 32 32 * Include files 33 *34 * @global BuddyPress $bp The one true BuddyPress instance35 33 */ 36 34 public function includes( $includes = array() ) { … … 54 52 55 53 // Define a slug, if necessary 56 if ( ! defined( 'BP_SETTINGS_SLUG' ) )54 if ( ! defined( 'BP_SETTINGS_SLUG' ) ) { 57 55 define( 'BP_SETTINGS_SLUG', $this->id ); 56 } 58 57 59 58 // All globals for settings component. … … 68 67 */ 69 68 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { 70 71 // Add the settings navigation item72 $main_nav = array(73 'name' => __( 'Settings', 'buddypress' ),74 'slug' => $this->slug,75 'position' => 100,76 'show_for_displayed_user' => bp_core_can_edit_settings(),77 'screen_function' => 'bp_settings_screen_general',78 'default_subnav_slug' => 'general'79 );80 69 81 70 // Determine user to use … … 88 77 } 89 78 90 $settings_link = trailingslashit( $user_domain . $this->slug ); 79 $access = bp_core_can_edit_settings(); 80 $slug = bp_get_settings_slug(); 81 $settings_link = trailingslashit( $user_domain . $slug ); 82 83 // Add the settings navigation item 84 $main_nav = array( 85 'name' => __( 'Settings', 'buddypress' ), 86 'slug' => $slug, 87 'position' => 100, 88 'show_for_displayed_user' => $access, 89 'screen_function' => 'bp_settings_screen_general', 90 'default_subnav_slug' => 'general' 91 ); 91 92 92 93 // Add General Settings nav item … … 95 96 'slug' => 'general', 96 97 'parent_url' => $settings_link, 97 'parent_slug' => $ this->slug,98 'parent_slug' => $slug, 98 99 'screen_function' => 'bp_settings_screen_general', 99 100 'position' => 10, 100 'user_has_access' => bp_core_can_edit_settings()101 'user_has_access' => $access 101 102 ); 102 103 … … 107 108 'slug' => 'notifications', 108 109 'parent_url' => $settings_link, 109 'parent_slug' => $ this->slug,110 'parent_slug' => $slug, 110 111 'screen_function' => 'bp_settings_screen_notification', 111 112 'position' => 20, 112 'user_has_access' => bp_core_can_edit_settings()113 'user_has_access' => $access 113 114 ); 114 115 … … 119 120 'slug' => 'capabilities', 120 121 'parent_url' => $settings_link, 121 'parent_slug' => $ this->slug,122 'parent_slug' => $slug, 122 123 'screen_function' => 'bp_settings_screen_capabilities', 123 124 'position' => 80, … … 132 133 'slug' => 'delete-account', 133 134 'parent_url' => $settings_link, 134 'parent_slug' => $ this->slug,135 'parent_slug' => $slug, 135 136 'screen_function' => 'bp_settings_screen_delete_account', 136 137 'position' => 90, … … 147 148 public function setup_admin_bar( $wp_admin_nav = array() ) { 148 149 149 // The instance150 $bp = buddypress();151 152 150 // Menus for logged in user 153 151 if ( is_user_logged_in() ) { 154 152 155 153 // Setup the logged in user variables 156 $user_domain = bp_loggedin_user_domain(); 157 $settings_link = trailingslashit( $user_domain . $this->slug ); 154 $settings_link = trailingslashit( bp_loggedin_user_domain() . bp_get_settings_slug() ); 158 155 159 156 // Add main Settings menu 160 157 $wp_admin_nav[] = array( 161 'parent' => $bp->my_account_menu_id,158 'parent' => buddypress()->my_account_menu_id, 162 159 'id' => 'my-account-' . $this->id, 163 160 'title' => __( 'Settings', 'buddypress' ), 164 'href' => trailingslashit( $settings_link )161 'href' => $settings_link 165 162 ); 166 163 … … 170 167 'id' => 'my-account-' . $this->id . '-general', 171 168 'title' => __( 'General', 'buddypress' ), 172 'href' => trailingslashit( $settings_link . 'general' )169 'href' => $settings_link 173 170 ); 174 171 -
trunk/src/bp-xprofile/bp-xprofile-activity.php
r9819 r9936 96 96 // your language doesn't have this restriction, feel free to use a more 97 97 // natural translation. 98 $profile_link = trailingslashit( bp_core_get_user_domain( $activity->user_id ) . b uddypress()->profile->slug);98 $profile_link = trailingslashit( bp_core_get_user_domain( $activity->user_id ) . bp_get_profile_slug() ); 99 99 $action = sprintf( __( '%s’s profile was updated', 'buddypress' ), '<a href="' . $profile_link . '">' . bp_core_get_user_displayname( $activity->user_id ) . '</a>' ); 100 100 … … 318 318 319 319 // If we've reached this point, assemble and post the activity item 320 $profile_link = trailingslashit( bp_core_get_user_domain( $user_id ) . b uddypress()->profile->slug);320 $profile_link = trailingslashit( bp_core_get_user_domain( $user_id ) . bp_get_profile_slug() ); 321 321 322 322 return (bool) xprofile_record_activity( array( -
trunk/src/bp-xprofile/bp-xprofile-loader.php
r9819 r9936 172 172 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { 173 173 174 $sub_nav = array(); 174 // Determine user to use 175 if ( bp_displayed_user_domain() ) { 176 $user_domain = bp_displayed_user_domain(); 177 } elseif ( bp_loggedin_user_domain() ) { 178 $user_domain = bp_loggedin_user_domain(); 179 } else { 180 return; 181 } 182 183 $slug = 184 $profile_link = trailingslashit( $user_domain . $this->slug ); 175 185 176 186 // Add 'Profile' to the main navigation … … 183 193 'item_css_id' => $this->id 184 194 ); 185 186 // Determine user to use187 if ( bp_displayed_user_domain() ) {188 $user_domain = bp_displayed_user_domain();189 } elseif ( bp_loggedin_user_domain() ) {190 $user_domain = bp_loggedin_user_domain();191 } else {192 return;193 }194 195 $profile_link = trailingslashit( $user_domain . $this->slug );196 195 197 196 // Add the subnav items to the profile … … 276 275 */ 277 276 public function setup_admin_bar( $wp_admin_nav = array() ) { 278 $bp = buddypress();279 280 // Prevent debug notices281 $wp_admin_nav = array();282 277 283 278 // Menus for logged in user … … 285 280 286 281 // Profile link 287 $profile_link = trailingslashit( bp_loggedin_user_domain() . $this->slug);282 $profile_link = trailingslashit( bp_loggedin_user_domain() . bp_get_profile_slug() ); 288 283 289 284 // Add the "Profile" sub menu 290 285 $wp_admin_nav[] = array( 291 'parent' => $bp->my_account_menu_id,286 'parent' => buddypress()->my_account_menu_id, 292 287 'id' => 'my-account-' . $this->id, 293 288 'title' => _x( 'Profile', 'My Account Profile', 'buddypress' ), 294 'href' => trailingslashit( $profile_link )289 'href' => $profile_link 295 290 ); 296 291 … … 300 295 'id' => 'my-account-' . $this->id . '-public', 301 296 'title' => _x( 'View', 'My Account Profile sub nav', 'buddypress' ), 302 'href' => trailingslashit( $profile_link . 'public' )297 'href' => $profile_link 303 298 ); 304 299 … … 339 334 */ 340 335 public function setup_title() { 341 $bp = buddypress();342 336 343 337 if ( bp_is_profile_component() ) { 338 $bp = buddypress(); 339 344 340 if ( bp_is_my_profile() ) { 345 341 $bp->bp_options_title = _x( 'My Profile', 'Page title', 'buddypress' ); … … 384 380 */ 385 381 public function setup_settings_admin_nav( $wp_admin_nav ) { 382 386 383 // Setup the logged in user variables 387 384 $settings_link = trailingslashit( bp_loggedin_user_domain() . bp_get_settings_slug() ); -
trunk/src/bp-xprofile/bp-xprofile-screens.php
r9819 r9936 53 53 function xprofile_screen_edit_profile() { 54 54 55 if ( ! bp_is_my_profile() && !bp_current_user_can( 'bp_moderate' ) )55 if ( ! bp_is_my_profile() && ! bp_current_user_can( 'bp_moderate' ) ) { 56 56 return false; 57 58 $bp = buddypress(); 57 } 59 58 60 59 // Make sure a group is set. 61 if ( !bp_action_variable( 1 ) ) 62 bp_core_redirect( trailingslashit( bp_displayed_user_domain() . $bp->profile->slug . '/edit/group/1' ) ); 60 if ( ! bp_action_variable( 1 ) ) { 61 bp_core_redirect( trailingslashit( bp_displayed_user_domain() . bp_get_profile_slug() . '/edit/group/1' ) ); 62 } 63 63 64 64 // Check the field group exists 65 if ( ! bp_is_action_variable( 'group' ) || !xprofile_get_field_group( bp_action_variable( 1 ) ) ) {65 if ( ! bp_is_action_variable( 'group' ) || ! xprofile_get_field_group( bp_action_variable( 1 ) ) ) { 66 66 bp_do_404(); 67 67 return; … … 78 78 79 79 // Check we have field ID's 80 if ( empty( $_POST['field_ids'] ) ) 81 bp_core_redirect( trailingslashit( bp_displayed_user_domain() . $bp->profile->slug . '/edit/group/' . bp_action_variable( 1 ) ) ); 80 if ( empty( $_POST['field_ids'] ) ) { 81 bp_core_redirect( trailingslashit( bp_displayed_user_domain() . bp_get_profile_slug() . '/edit/group/' . bp_action_variable( 1 ) ) ); 82 } 82 83 83 84 // Explode the posted field IDs into an array so we know which … … 181 182 182 183 // Redirect back to the edit screen to display the updates and message 183 bp_core_redirect( trailingslashit( bp_displayed_user_domain() . $bp->profile->slug. '/edit/group/' . bp_action_variable( 1 ) ) );184 bp_core_redirect( trailingslashit( bp_displayed_user_domain() . bp_get_profile_slug() . '/edit/group/' . bp_action_variable( 1 ) ) ); 184 185 } 185 186 } … … 212 213 213 214 // Bail if not the correct screen 214 if ( ! bp_is_my_profile() && !bp_current_user_can( 'bp_moderate' ) )215 if ( ! bp_is_my_profile() && ! bp_current_user_can( 'bp_moderate' ) ) { 215 216 return false; 217 } 216 218 217 219 // Bail if there are action variables … … 223 225 $bp = buddypress(); 224 226 225 if ( ! isset( $bp->avatar_admin ) ) 227 if ( ! isset( $bp->avatar_admin ) ) { 226 228 $bp->avatar_admin = new stdClass(); 229 } 227 230 228 231 $bp->avatar_admin->step = 'upload-image'; -
trunk/src/bp-xprofile/bp-xprofile-template.php
r9819 r9936 522 522 * profile group edit form. 523 523 */ 524 return apply_filters( 'bp_get_the_profile_group_edit_form_action', trailingslashit( bp_displayed_user_domain() . $bp->profile->slug. '/edit/group/' . $group->id ) );524 return apply_filters( 'bp_get_the_profile_group_edit_form_action', trailingslashit( bp_displayed_user_domain() . bp_get_profile_slug() . '/edit/group/' . $group->id ) ); 525 525 } 526 526 … … 1029 1029 1030 1030 // Build the profile field group link 1031 $link = trailingslashit( bp_displayed_user_domain() . b uddypress()->profile->slug. '/edit/group/' . $groups[ $i ]->id );1031 $link = trailingslashit( bp_displayed_user_domain() . bp_get_profile_slug() . '/edit/group/' . $groups[ $i ]->id ); 1032 1032 1033 1033 // Add tab to end of tabs array … … 1136 1136 } 1137 1137 function bp_get_avatar_delete_link() { 1138 $bp = buddypress();1139 1138 1140 1139 /** … … 1145 1144 * @param string $value Nonced URL used for deleting an avatar. 1146 1145 */ 1147 return apply_filters( 'bp_get_avatar_delete_link', wp_nonce_url( bp_displayed_user_domain() . $bp->profile->slug. '/change-avatar/delete-avatar/', 'bp_delete_avatar_link' ) );1146 return apply_filters( 'bp_get_avatar_delete_link', wp_nonce_url( bp_displayed_user_domain() . bp_get_profile_slug() . '/change-avatar/delete-avatar/', 'bp_delete_avatar_link' ) ); 1148 1147 } 1149 1148 1150 1149 function bp_edit_profile_button() { 1151 $bp = buddypress();1152 1153 1150 bp_button( array( 1154 1151 'id' => 'edit_profile', … … 1156 1153 'must_be_logged_in' => true, 1157 1154 'block_self' => true, 1158 'link_href' => trailingslashit( bp_displayed_user_domain() . $bp->profile->slug. '/edit' ),1155 'link_href' => trailingslashit( bp_displayed_user_domain() . bp_get_profile_slug() . '/edit' ), 1159 1156 'link_class' => 'edit', 1160 1157 'link_text' => __( 'Edit Profile', 'buddypress' ), -
trunk/tests/phpunit/testcases/routing/xprofile.php
r9819 r9936 20 20 21 21 function test_member_profile() { 22 $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . b uddypress()->profile->slug);22 $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_profile_slug() ); 23 23 $this->assertTrue( bp_is_user_profile() ); 24 24 } 25 25 26 26 function test_member_profile_edit() { 27 $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . b uddypress()->profile->slug. '/edit' );27 $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_profile_slug() . '/edit' ); 28 28 $this->assertTrue( bp_is_user_profile_edit() ); 29 29 } 30 30 31 31 function test_member_profile_change_avatar() { 32 $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . b uddypress()->profile->slug. '/change-avatar' );32 $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_profile_slug() . '/change-avatar' ); 33 33 $this->assertTrue( bp_is_user_change_avatar() ); 34 34 } -
trunk/tests/phpunit/testcases/xprofile/activity.php
r9819 r9936 304 304 ) ); 305 305 306 $expected = sprintf( __( '%s’s profile was updated', 'buddypress' ), '<a href="' . bp_core_get_user_domain( $u ) . b uddypress()->profile->slug. '/">' . bp_core_get_user_displayname( $u ) . '</a>' );306 $expected = sprintf( __( '%s’s profile was updated', 'buddypress' ), '<a href="' . bp_core_get_user_domain( $u ) . bp_get_profile_slug() . '/">' . bp_core_get_user_displayname( $u ) . '</a>' ); 307 307 308 308 $a_obj = new BP_Activity_Activity( $a );
Note: See TracChangeset
for help on using the changeset viewer.