Skip to:
Content
Pages
Categories
Search
Top
Bottom

Identify "/membername/" in Admin Bar?

  • @geo407

    Member

    Hello! I’d like to add links in my wordpress page navigation using the “Page Links To” plugin to point to the corresponding links that are in the adminbar like http://siteurl.com/members/membername/

    or http://siteurl.com/members/membername/profile/

    My question is where in the BP code can I find what defines “membername” in the urls above and create a dynamic link based on the membername variable? I think that makes sense…lol… please let me know if you need any more info to answer & many thanks in advance for any help!

Viewing 7 replies - 1 through 7 (of 7 total)
  • @r-a-y

    Keymaster

    Check out /plugins/buddypress/bp-core/bp-core-templatetags.php

    Specifically:

    bp_get_member_permalink()

    [EDIT]

    You’re looking for user_login for the “membername” part.

    Look at:

    https://codex.wordpress.org/Function_Reference/get_userdata

    https://codex.wordpress.org/Function_Reference/get_currentuserinfo

    @geo407

    Member

    r-a-y, thanks so much for the reply. I think I’m sooo close to what I’m trying to accomplish, but I can’t seem to get the name to echo.. for ex. I’d like to create a link like http://siteurl.com/members/<?php echo user_login() ;?>/profile

    Could you point me in the right direction as to how to do this?

    Many Many Thanks!

    @r-a-y

    Keymaster

    If you just want to output a link with the logged in user’s name, use:

    <?php bp_loggedinuser_link() ?>

    @geo407

    Member

    Thanks, that definitely works, but instead of the entire link I just need to echo the username

    for ex. <?php bp_loggedinuser_link() ?> gets me the text “george” which is a link to http://mysite.com/members/george/

    I’d like to get just the user name “george” with no link attached. Is this possible?

    Thanks for taking the time to respond, much appreciated.

    @pcwriter

    Participant

    @geo407

    Try this wherever you want the username to appear:

    <?php bp_loggedin_user_username() ?>

    Should work ;-)

    @smuda

    Participant

    @pcwriter i use

    <?php echo $username; ?>

    is your solution better?

    @pcwriter

    Participant

    @smuda

    I honestly can’t say if it’s better or not ‘cuz I’m a php newbie. Someone more knowledgeable than I would have to answer that question.

    What I can say though is that it works just fine.

    Sorry I can’t be of more help than that…

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Identify "/membername/" in Admin Bar?’ is closed to new replies.
Skip to toolbar