Hi @adjunkten,
Yes ! But you cannot use a variable (current user) in a ordinary menu. So the question is,
where do you need this menu ?
Cheers,
I would like it to be in the topmenu of my site, when a user is logged in.
In the wordpress menu settings I can link to buddypress ‘activity’ – which uses a variable – so why not friends activity which resembles FB’s start page?
In the menu settings you can link to the activity page, not to a specific activity (so far i know).
I posted 3 snippets on Github to test and choose what you need/prefer to use.
Copy/paste the code into bp-custom.php
Thanks danbp! Exactly what I was looking for.
And my first experience bp-custom.php .
I would prefer the last option with a link in the wp menu bar next to ‘log ind’ in the top right: My site
– the only problem is, that the rest of my menu items disappear when I use that snippet.
Can you fix that?
I read another solution here
1. Install and activate this plugin https://wordpress.org/plugins/wp-exec-php/
2. Create a new page called “Friends” or whatever name you want and add it to your menu.
3. In content of this page, add this code
<meta http-equiv=”refresh” content=”0;URL=http://blabla.com/members/<?php global $current_user;
get_currentuserinfo();
echo sanitize_file_name($current_user->user_login). “”;
?>/activity/friends/”>
4. You may still need a way to hide this menu from logged out users. Plugin https://wordpress.org/plugins/if-menu/
Thanks a lot.
Maybe a little over the top to install to new plugins… Afterall, danbp’s code works from the top wp menu.