Adding a link to view User's own Media

Hi everyone,

Could someone please tell me how to add a link into my Navigation menu so that when a logged in user clicks “Media” they go to their Media page? I have a link for every other function in BuddyPress (Ie. Activity, Profile, Messages, etc.) … just need this one!

Thanks :slight_smile: xx

normally, in the bp-user-navigation is a “media”-tab, this one redirekt directly to the logged-in-user media-page or did you create a global media-link in the main-navigation? if it’s so, then it doesent work respectively i never find a solution.

best regards

tomas

Hi victoria,

You can do the same in your dashboard by adding the URL under links section shown in Appearance-> Menus (http://yoursite.com/wp-admin/nav-menus.php) and adding that to your primary navigation menu . (Make sure Navigation Menu check is enabled in Menu’s settings)


Regards,
Sumeet

@h2waldmann When i go to Navigation > Menus, I don’t see a “Media” option under the BuddyPress Logged-In section of links to add. I see Activity, Forums, Friends, etc. which all work great. I’m not sure what you mean by bp-user-navigation and global meda-link… Are these part of the plugin files?

@sumeetsarna I’ve already checked in Appearance > Menus. The link is not there. I’m using Version 3.7.5. Can you tell me what to type exactly into the “Links” section you mention?

Thanks! :slight_smile:

Hi Victoria,

Ignore my previous reply. In rtMedia Settings -> BuddyPress-> Set enable media in profile / Group to ON and you’ll see the Media tab in all user profiles and in Groups.

Regards,
sumeet

I already have that checked, and that only enables the Media button in the user’s profile page. What I would like to do is add that Media link into the Navigation menu of a logged-in user.

Does anyone know how to contact support? @system ?

Hi Victoria,

Apologies for the late reply.

Add following code in your theme to add Media link into navigation menu.

function my_wp_get_nav_menu_items( $items, $menu, $args ){
	if ( is_user_logged_in() && class_exists( 'RTMedia' ) ) {
		$user_id = get_current_user_id();	// get current logged in user id
		$url = trailingslashit ( get_rtmedia_user_link ( get_current_user_id () ) ) . RTMEDIA_MEDIA_SLUG . '/'; 	// get user's media link

		// add new menu item to nav menu
		$new_item = new stdClass;
		$new_item->menu_item_parent = 0;
		$new_item->url = $url;
		$new_item->title = 'My Media';
		$new_item->menu_order = count( $items ) + 1;
		$items[] = $new_item;
	}
	return $items;
}

add_filter( 'wp_get_nav_menu_items', 'my_wp_get_nav_menu_items', 99, 3 );
2 Likes

Hi! thank you so much, your code works, but it adds “My Media” directly to the Navigation menu. I’d like for the Media button to appear below the “Profile” section on my Navigation menu. That’s where I have the other Buddy Press options such as Activity, Notifiations, Messages, Forums, etc.

@riteshpatel Also, here’s a screenshot to show you what I mean: http://oi59.tinypic.com/2v3g64y.jpg

I want the “My Media” link to appear as “Photos” under the Profile navigation dropdown.

Thanks so much for your help!! :slight_smile:

For someone need and have font awesome icons on menu try this:

$new_item->title = '<i class="fa fa-heart fa-fw"></i>My Media';

Maybe this help, thank you

Question: this code put My media in all wordpress menus on my theme, there is a solution for this? I only want to see in specific menu, Thanks so much

can someone please answer the original question here how do you put a link to “media” so i can add it to a custom wordpress menu as a sub navigation item under profile?