Skip to:
Content
Pages
Categories
Search
Top
Bottom

screen_function in bp_core_new_subnav_item not working – adding a menu item


  • nicholmikey
    Participant

    @nicholmikey

    Hello,

    I am trying to add a sub menu item using bp_core_new_subnav_item function. The menu item appears and if I hover over it shows it is going to the correct location, but when I click it is just brings be to the root of the site. I have tried several methods an nothing has worked. I checked how other plugins do it and they all use a similar method to what is below.

    Does anyone have any idea what is going on?

    `add_action(‘wp’, ‘CubePoints_List_Menu’);
    function CubePoints_List_Menu(){

    global $bp;
    $cubepoint_link = ($bp->displayed_user->id ? $bp->displayed_user->domain : $bp->loggedin_user->domain) . $bp->cubepoint->slug . ‘/’;
    global $wp_filter;

    bp_core_new_subnav_item( array(
    ‘name’ =>’test’,
    ‘slug’ => ‘top_points’,
    ‘parent_slug’ => $bp->cubepoint->slug,
    ‘parent_url’ => $cubepoint_link,
    ‘screen_function’ => ‘top_points_screen’,
    ‘position’ => 70,
    ) );
    }

    function top_points_screen() {
    global $bp;

    add_action( ‘bp_template_title’, ‘top_points_events_title’ );
    add_action( ‘bp_template_content’, ‘top_points_events_content’ );
    bp_core_load_template( apply_filters( ‘bp_core_template_plugin’, ‘members/single/plugins’ ) );
    //bp_core_load_template( apply_filters( ‘bp_em_template_screen_one’, ’em/screen-one’ ) );
    }
    /***
    * The second argument of each of the above add_action() calls is a function that will
    * display the corresponding information. The functions are presented below:
    */
    function top_points_events_title() {
    echo ‘Top Points’;
    }

    function top_points_events_content() {
    global $bp;

    ?>

    hello world

    <?php
    }
    ?>`

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘screen_function in bp_core_new_subnav_item not working – adding a menu item’ is closed to new replies.
Skip to toolbar