Skip to:

Get Username ???

  • trcwest


    Hi there i have a button that creates a group or in my case a spot and i have been using this on my main blog theme..

    <?php echo wt_get_user_name(); ?>

    this it in full

    <?php if ( is_user_logged_in() ) : ?>

    <div id=”create-spot”>


    <img src=”; alt=”creat spot” />


    <?php else : ?>

    <?php endif; ?>

    BUT on the bp theme it doesnt work and it kills the whole theme..

    is there an alternative echo username php function to this… <?php echo wt_get_user_name(); ?>

Viewing 10 replies - 1 through 10 (of 10 total)

  • Burt Adsit


    Post the code for wt_get_user_name() here and leave a link



    This is what i have in my main blog theme that works nicely.. in the wordpress header..

    I just want to do the same thing on the buddy press side of things..

    the above code doesnt work on the buddy press side.

    I have been trying things like..

    <?php echo bp_the_site_member_name(); ?>

    The idea is to just alow for a quick create group button that takes dynamically adds the users username based on this url..!!!!!username!!!!!/spots/create/

    does that make sense??



    i realise i may have to define the user name and then echo it but i dont know how to do this..



    global $current_user;

    $username = $current_user->user_login;;?php echo $username; ?>/spots/create/’



    Thank you so so so so so much that worked nicely..


    Sorry to bring this topic back up, but I am having a similar problem.

    I want to add a “Create a Group” button on my Groups page, and to be honest, I’m confused why buddypress wouldn’t put one there to begin with.

    So the link I tried (from the code above) is :

    href=”members/<?php echo $current_user; ?>/cells/create/”>Create a Group

    But where do I put the :

    global $current_user;

    $username = $current_user->user_login;

    part of the code?

    Paul Gibbs


    Such a button has been added to the default 1.2 theme.

    Try this


    Hmm, didn’t work, it just took me back to the homepage.

    Maybe I’m doing something wrong, I’ll have a look.

    Mike Greening


    I was able to get what I wanted by using the following code. It’s a link and not a button, but it also detects whether the user is logged in and displays a different message if they are not, so you can send them to the sign up page.

    <?php if ( !is_user_logged_in() ) : ?>

    <p>Don’t see a group you like? < href=”../register”>Login or Sign Up to create a new group.</p>

    <?php else : ?>

    <p>Don’t see a group that can help you? < href=”../members/<?php global $current_user; get_currentuserinfo(); echo $current_user->user_login; ?>/groups/create/step/group-details”>Create a new group.</p>

    <?php endif; ?>

    Apparently there’s a get_currentuserinfo() function somewhere that lets you grab info, just like in WordPress. Go figure.

    (Note: I took the “a”s out of the code because this forum is making them into links and the backticks are inexplicably not working)

    MJ Banco


    Thanks for this, though I used bp_loggedinuser_link() instead.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Get Username ???’ is closed to new replies.
Skip to toolbar