[Resolved] Create a new custom root slug …
-
Hi,
I’m a new user of buddypress and i try to create a plugin which add some new root slug to bp.
But i have a problem : it didn’t works (my first screen don’t appear on : http://mybpwebsite/myslug/ )I try to log my function setup call and it appears that none of my setup function are called ( myslug_setup_globals, myslug_setup_root_component, myslug_setup_nav)
Here is a sample of my code ( i start develop by using the skeleton component ) :
if ( !defined( ‘BP_myslug_SLUG’ ) ) define ( ‘BP_myslug_SLUG’, ‘myslug’ ); function myslug_setup_globals() { global $bp, $wpdb; trace(‘myslug globals’); /* For internal identification */ $bp->myslug->id = ‘myslug'; $bp->myslug->slug = BP_myslug_SLUG; /* Register this in the active components array */ $bp->active_components[$bp->myslug->slug] = $bp->myslug->id; $bp->myslug->forbidden_names = apply_filters( ‘myslug_forbidden_names’, array( BP_myslug_SLUG ) ); do_action( ‘myslug_setup_globals’ ); } add_action( ‘bp_setup_globals’, ‘myslug_setup_globals’ ); function myslug_setup_root_component() { trace(‘myslug root’); /* Register ‘myslug’ as a root component */ bp_core_add_root_component( BP_myslug_SLUG ); } add_action( ‘bp_setup_root_components’, ‘myslug_setup_root_component’ ); function myslug_setup_nav() { global $bp; trace(‘myslug nav’); /* Add ‘Example’ to the main user profile navigation */ bp_core_new_nav_item( array( ‘name’ => __( ‘myslug’, ‘bp-myslug’ ), ‘slug’ => BP_myslug_SLUG, ‘screen_function’ => ‘myslug_screen’ ) ); } add_action( ‘bp_setup_nav’, ‘myslug_setup_nav’ ); // Screen functions function myslug_screen() { global $bp; trace(‘plop’); if ( !$bp->current_component == BP_myslug_SLUG) { return; } echo “Yo !! “; echo $bp->current_action; } trace(‘glob’);
So any idea what’s the problem ?
Thanks
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘[Resolved] Create a new custom root slug …’ is closed to new replies.