Skip to:
Content
Pages
Categories
Search
Top
Bottom

Create subnav in profile nav


  • warut
    Participant

    @warut

    Hello,

    I coding badge plugin and want to create subnav in profile like public, edit profile, change avatar. Is it possible?

    I dont want to create it new nav in use profile because it have many tab in user profile now. when i try to code like this

    $badge_link = $bp->loggedin_user->domain . $bp->profile->slug . ‘/’;

    bp_core_new_subnav_item( array(

    ‘name’ => __( ‘screenone’, ‘bp-badge’ ),

    ‘slug’ => ‘screenone’,

    ‘parent_slug’ => $bp->profile->slug,

    ‘parent_url’ => $badge_link,

    ‘screen_function’ => ‘bp_badge_screenone’,

    ‘position’ => 10

    ) );

    Then it create subnav in profile tab but after click on it, it go to main page.

    what i am do wrong?

Viewing 3 replies - 1 through 3 (of 3 total)

  • Paul Wong-Gibbs
    Keymaster

    @djpaul

    You might be calling bp_core_new_subnav_item() too late in the load order; it’d be creating your HTML correctly but loading too late to intercept the page URL. Where/how are you calling this?


    warut
    Participant

    @warut

    Thanks for reply DJPaul,

    just copy from skeleton loader.php and bp_example_core.php

    ######## loader.php ########

    function bp_badge_init() {

    require( dirname( __FILE__ ) . ‘/includes/bp-badge-core.php’ );

    }

    add_action( ‘bp_init’, ‘bp_badge_init’ );

    function bp_badge_activate() {

    global $wpdb;

    }

    register_activation_hook( __FILE__, ‘bp_badge_activate’ );

    ###### bp_example_core.php #######

    after activate plugin it call bp_example_core.php

    .

    .

    function bp_badge_setup_nav() {

    global $bp;

    $badge_link = $bp->loggedin_user->domain . $bp->profile->slug . ‘/’;

    bp_core_new_subnav_item( array(

    ‘name’ => __( ‘screenone’, ‘bp-badge’ ),

    ‘slug’ => ‘screen-one’,

    ‘parent_slug’ => $bp->profile->slug,

    ‘parent_url’ => $badge_link,

    ‘screen_function’ => ‘bp_badge_screen’,

    ‘position’ => 10

    ) );

    add_action( ‘wp’, ‘bp_badge_setup_nav’, 2 );

    add_action( ‘admin_menu’, ‘bp_badge_setup_nav’, 2 );

    ######

    if i create main nav and setup subnav in it everything ok


    warut
    Participant

    @warut

    “it’d be creating your HTML correctly but loading too late to intercept the page URL”

    how about load order ? can you explain in detail or where can i found the document?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Create subnav in profile nav’ is closed to new replies.
Skip to toolbar