You have some other BuddyPress plugins that is causing this notice.
For now, I would recommend turning off WP_DEBUG
mode on your production site.
Can you provide the complete code you use for that and also tell where the menu item goes inside groups ?
Here is the function where I create a dynamic Menu . This function is called from a ‘wp_nav_menu_items’ filter function. The below function creates a dynamic menu based on the buddypress groups the user is entitled to. The idea is to provide navigation to the groups directly via a Menu.
function get_entitled_groups_menu_html()
{
$dataset = getDS_entitled_groups();
$html = "";
foreach($dataset as $row)
{
$url = site_url()."/groups/".$row->slug;
$html .= '<ul id="menu-item-381" align="right" class="bp-menu bp-groups-nav current_page_item current-menu-item menu-item menu-item-type-bp_nav menu-item-object-bp_loggedin_nav menu-item-381">';
$html .= '<a href="'.$url.'">'.$row->name.'</a></ul>';
}
return $html;
}
The menu renders properly, however when clicked I get the warning. I know I can suppress the warning by turning WP_DEBUG off, but the fact that it does not throw an warning, when I navigate to the group page via going to groups page and then selecting the individual group, but only does when I navigate via this function makes me think there must be a better way.
Hi,
Assuming you want to add a menu item to WP main nav bar as single menu item
Try this, from within bp-custom.php
/* link to My Groups on WP main menu */
function my_nav_menu_group_link( $menu ) {
if ( !is_user_logged_in() )
return $menu;
else
$grouplink = '<li><a href="' . bp_loggedin_user_domain() . '/groups/">My Groups</a></li>';
$menu = $menu . $grouplink;
return $menu;
}
add_filter( 'wp_nav_menu_items', 'my_nav_menu_group_link' );
I tried that, still get the same warning 🙁