Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'd like to add a link to BuddyPress' My Favourite Topics in a Custom Menu. Is there a way to use the current logged in user's username in the link?

I mean like the %category% in the permalinks.

share|improve this question

2 Answers 2

You can access the user's display name through get_currentuserinfo() function. You would first need to set the global then you can access the display name.

<?php global $current_user;
      get_currentuserinfo();

      echo 'Hello, ' . $current_user->display_name . "\n";
?>
share|improve this answer

Yes there is a way how you can do it. To implement it properly I would recommend you to read The Rewrite API: The Basics article. Especially pay attention on Add Rewrite Tag section.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.