Skip to:
Content
Pages
Categories
Search
Top
Bottom

Restrict New nav Item access


  • amargarido
    Participant

    @amargarido

    Hello,

    What is on way or the correct one to lock a new profile menu ?

    When a user access a ‘declaration’, this info is personnal. Only he/she or the admin could see ‘declaration’ menu.

    I m still searching for an answer with no luck.


    if ( function_exists( 'bp_is_active' ) && is_user_logged_in() ) {
    add_action( 'bp_setup_nav', 'dynamus_declaracao_profile_menu_creation' , 1000 /*301*/ );
    function dynamus_declaracao_profile_menu_creation() {
    global $bp;
    bp_core_new_nav_item( array(
    'name' => __( 'Declaração', 'buddypress' ),
    'slug' => 'my-all-conversations',
    'position' => 75,
    'screen_function' => 'dynamus_declaracao_link',
    'show_for_displayed_user' => true,
    'default_subnav_slug' => 'dynamus-declaracao',
    'item_css_id' => 'dynamus-declaracao'
    ) );
    }

    function dynamus_declaracao_title() {

    echo 'My Declaracao !';
    }

    function dynamus_declaracao_content() { ?>
    <div id="groups-dir-list" class="groups dir-list">
    <?php locate_template( array( 'groups/groups-loop.php' ), true ) ?>
    </div><!-- #groups-dir-list -->
    <?php
    }

    function dynamus_declaracao_link () {
    add_action( 'bp_template_title', 'dynamus_declaracao_title' );
    add_action( 'bp_template_content', '_content' );
    bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
    }

    }

    Thanks in advance for any tips !

    Alberto

    WP 4.3.1
    BP Latest

Viewing 1 replies (of 1 total)

  • amargarido
    Participant

    @amargarido

    So I found it…

    under bp_core_new_nav_item the show_for_displayed_user parameter set to false.

    
    array(  'name' =>'Photo Uploads', 
    'slug' => 'photo-uploads', 
    'show_for_displayed_user' => false,
    'screen_function' => 'your_function_to_display_page', 
    'position' => 75 
    );
    
Viewing 1 replies (of 1 total)
  • The topic ‘Restrict New nav Item access’ is closed to new replies.
Skip to toolbar