BP_Nouveau_Customizer_Group_Nav::setup_nav()
Setup a temporary nav with only the needed parameters.
Description
Source
File: bp-templates/bp-nouveau/includes/groups/classes.php
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 | protected function setup_nav() { $nav_items = array ( 'root' => array ( 'name' => __( 'My Groups' , 'buddyboss' ), 'slug' => $this ->group->slug, 'position' => -1, /** This filter is documented in bp-groups/classes/class-bp-groups-component.php. */ 'default_subnav_slug' => apply_filters( 'bp_groups_default_extension' , defined( 'BP_GROUPS_DEFAULT_EXTENSION' ) ? BP_GROUPS_DEFAULT_EXTENSION : 'home' ), ), 'members' => array ( 'name' => __( 'Members' , 'buddyboss' ), 'slug' => 'members' , 'parent_slug' => $this ->group->slug, 'position' => 10, ), 'invites' => array ( 'name' => __( 'Send Invites' , 'buddyboss' ), 'slug' => 'send-invites' , 'parent_slug' => $this ->group->slug, 'position' => 70, ), 'manage' => array ( 'name' => __( 'Manage' , 'buddyboss' ), 'slug' => 'admin' , 'parent_slug' => $this ->group->slug, 'position' => 1000, ), ); if ( bp_is_active( 'forums' ) && function_exists( 'bbp_is_group_forums_active' ) ) { if ( bbp_is_group_forums_active() ) { $nav_items [ 'forum' ] = array ( 'name' => __( 'Discussions' , 'buddyboss' ), 'slug' => get_option( '_bbp_forum_slug' , 'forum' ), 'parent_slug' => $this ->group->slug, 'position' => 30, ); } } if ( bp_enable_group_hierarchies() ) { $nav_items [ 'subgroups' ] = array ( 'name' => __( 'Subgroups' , 'buddyboss' ), 'slug' => 'subgroups' , 'parent_slug' => $this ->group->slug, 'position' => 30, ); } if ( function_exists( 'bp_ld_sync' ) ) { $va = bp_ld_sync( 'settings' )->get( 'buddypress.enabled' , true ); if ( '1' === $va ) { $nav_items [ 'courses' ] = array ( 'name' => __( 'Courses' , 'buddyboss' ), 'slug' => 'courses' , 'parent_slug' => $this ->group->slug, 'position' => 40, ); } } if ( function_exists( 'bp_ld_sync' ) ) { $va = bp_ld_sync( 'settings' )->get( 'reports.enabled' , true ); if ( '1' === $va ) { $nav_items [ 'reports' ] = array ( 'name' => __( 'Reports' , 'buddyboss' ), 'slug' => 'reports' , 'parent_slug' => $this ->group->slug, 'position' => 40, ); } } if ( bp_is_active( 'activity' ) ) { $nav_items [ 'activity' ] = array ( 'name' => __( 'Feed' , 'buddyboss' ), 'slug' => 'activity' , 'parent_slug' => $this ->group->slug, 'position' => 20, ); } // Required params $required_params = array ( 'slug' => true, 'name' => true, 'nav_item_position' => true, ); // Now find nav items plugins are creating within their Group extensions! foreach ( get_declared_classes() as $class ) { if ( is_subclass_of ( $class , 'BP_Group_Extension' ) ) { $extension = new $class ; if ( ! empty ( $extension ->params ) && ! array_diff_key ( $required_params , $extension ->params ) ) { $nav_items [ $extension ->params[ 'slug' ] ] = array ( 'name' => $extension ->params[ 'name' ], 'slug' => $extension ->params[ 'slug' ], 'parent_slug' => $this ->group->slug, 'position' => $extension ->params[ 'nav_item_position' ], ); } } } // Now we got all, create the temporary nav. foreach ( $nav_items as $nav_item ) { $this ->add_nav( $nav_item ); } } |
Changelog
Version | Description |
---|---|
BuddyPress 3.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.