add a menu item in buddypress [on hold]

i want add a new link (link of a specific post-page)on the buddypress menu, i have already found a code like this :

add_action( 'bp_member_options_nav', 'buddydev_add_profile_extra_custom_links' );  function buddydev_add_profile_extra_custom_links() {     ?> <li><a href="">Google</a></li>   <?php  } 

it work fine , but have some restriction, It is always visible both for those registered users that are not registered, it is also visible both to the owner (author) of the profile and also to other users.

I would like something with the same conditions of the function: bp_core_new_nav_item()

where you can restrict the page only for author with show_for_displayed_user

and other restriction.

now if use bp_core_new_nav_item() i have a code like this:

add_action('bp_setup_nav', 'bp_profile_new_link', 301 ); function bp_profile_new_link() { global $bp; bp_core_new_nav_item(     array(         'name' => 'test',         'slug' => 'testslug',          'position' => 12,          'default_subnav_slug' => 'published',         'screen_function' => 'link_callback',         'show_for_displayed_user' => false,       ) ); }   function link_callback(){     /* code for point to specific page */ } 

now where is the best solution on this point for point to a specific page ? redirect ? native function of buddypress or other ?


Category: php Time: 2016-07-28 Views: 0

Related post

  • How do i use hook_menu to add a menu item into an exisiting menu 2011-12-28

    as the title says i'm trying to add a menu item to the user-menu. I'm using the following code: function sawqr_menu() { $items['user/%user/qr'] = array( 'title' => t('QR Code Management'), 'page callback' => 'sawqr_view_embed', 'page arguments' =>

  • how do I add "home" menu item conditionally to custom menus? 2012-03-16

    Original question How do I get menu items using slug and not ID I need to get a specific menu, but I can't use ID, since the menu ID on my dev is not the same as on my staging and prod server. WP doc says that wp_get_nav_menu_itemscan be used with me

  • add a menu item to navigation menu to link to external url 2012-07-05

    I followed this tutorial to add a menu item to navigation menu to link to external site: I copied the snippet of code to my theme's header.php I created a page with the name having the

  • Menu limit, cannot add new menu items 2012-12-12

    I'm running WP 3.4.2 on a VPS. When I first moved to this VPS server and imported all my WP data from the old, the menus worked fine. However, for some reason, I cannot edit/add to the menus, and some items have been deleted. No matter how many times

  • How do I add a menu item to a Pods admin menu? 2013-07-18

    I'm writing a plugin that will send a notification message to an external queue whenever a menu item is clicked. This function is related to some customized data structures I made using the Pods framework. I'd like to add the menu item under the sub-

  • How to add multiple menu items with same URL through a module? 2013-08-30

    I'm looking to add a menu item to the main menu (top navigation on Bartik) through a custom module. Problem is, looks like Drupal keys all links across the board by URL so node/add/doc will only show up in the node/add list or the main menu, not both

  • Add context menu items to specific file extensions 2014-04-04

    I think the title says all I want: I want to add context menu items for a specific file type like the yellow marked ones in the screenshot. Which registry changes do I have to make? In my case I want to assign ir.exe to .rb files. --------------Solut

  • Can't add any menu items anymore, server related 2015-02-19

    Unsure if this fits here, but hopefully it does. So I'm having an issue that I can't add any menu items to a custom menu anymore. At this very point I can verify that it's server related, since this issue is appearing now on multiple Wordpress instal

  • How do I add a menu item to the main navigation from a custom module in Drupal 8? 2015-04-14

    For my custom Drupal 8 module I want to add a link to the default main navigation menu of the site. What parent ID do I have to give to insert my menu item into the main menu? I currently have the following config in entity.

  • Cygwin shell add context menu item 2015-04-23

    There's this question on SO: I want to do something opposite. When using terminal I want to right click and have context menu item "Open Explorer here" to open regular W

  • how to add Custom menu item like User name in Header Menu only 2013-09-19

    I am new to Wordpress I am setting up wordpress Site which has 3 Menus Top menu Header Menu Footer Menu My issue is I need to add the User name to My Top menu Only when User is Logged in But using below Code snippet it adds the Custom menu Item in al

  • How to add nav menu items to a specific position within a menu 2013-11-07

    I'm adding login/logout links to a nav menu using the following code: function rp_add_login_logout_links( $items, $args ) { $link = wp_loginout( get_permalink( get_option( 'woocommerce_myaccount_page_id' ) ), false ); if ( 'Shop Menu' == $args->menu

  • add current-menu-item to multiple custom post types 2015-01-01

    I have two custom post types, and I have trouble adding the current-menu-item to both. In my functions.php I have following code: function additional_active_item_classes($classes = array(), $menu_item = false){ global $wp_query; if(in_array('current-

  • How to add Blender menu item in main menu? 2010-12-01

    Downloaded blender. How can I add menu item with blender icon in main menu? --------------Solutions------------- Before you try to add it to the menu: You should probably install the version of Blender that is available via the Software Centre: Open

  • How do I add the menu item description to the menu? 2011-04-05

    Normal Wordpress Menu looks like: Home | Blog | About us | Contact But I've seen many pages with descriptions under these links: Home Page | Our Blogs | About us | Contact us...| read more| basic info| contact form How to achieve this? (I wa

  • Add administration menu item in D6 for one role only 2011-07-07

    I have a module that has configuration pages in the administration side. I want to have one role that's just for administrating that module, but doesn't have any other administrative privileges. I can give this role access to the path admin/settings/

  • Using hook_menu in a custom module, how do you add a menu item to more than one menu in Drupal 7? 2012-04-18

    I am working with Drupal 7. I have created a custom module that supplies several menu items using hook_menu. I am adding one of these menu items to the main menu: $items['my-chapter'] = array( 'title' => 'My Chapter', 'page callback' => 'mymodule_my

  • How to add custom menu item on plugin activation? 2012-08-12

    When my plugin is activated, I would like to add a new menu item. Here is my code: class My_Plugin { function __construct() { register_activation_hook(__FILE__, array($this, 'install')); } function install() { add_action('admin_menu', array($this, 'a

  • Add context menu item to children of directory 2012-08-18

    Is it possible to add a context menu item to the folders of a certain directory? The user needs to be able to run a powershell script on a directory via a right click. However, the menu item only needs to exist for the children of one specific direct

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development


Front-end development


development tools

Open Platform

Javascript development

.NET development

cloud computing


Copyright (C), All Rights Reserved.

processed in 1.909 (s). 13 q(s)