Hey i installed buddypress and wanted to know if there is a theme function o can add so that on my theme it says

Login • Sign Up

and when they login it says

My Profile • Sign Out

2 Answers 2


There isn't a specific function that will do this, but it's definitely something you can add to your site. Personally, I've added a custom widget to one of my sites that displays this kind of functionality in the upper-right corner.

Here is some of the code I use:

$current_user = wp_get_current_user();
$email_hash = md5( $current_user->user_email );
<div class="login_widget">
    <?php if ( is_user_logged_in() ) { ?>
        <div class="actions">
                <li class="first-line">Welcome, <?php echo $current_user->display_name; ?>!</li>
                <li><a href="<?php echo admin_url( 'profile.php' ); ?>" title="Profile">Manage Your Profile</a></li>
                <li><a href="<?php echo wp_logout_url( home_url() ); ?>" title="Logout">Log Out</a></li>
        <img src="http://www.gravatar.com/avatar/<?php echo $email_hash; ?>?s=50" alt="Gravatar" width="50" height="50" />
    <?php } else { ?>
        <div class="actions">
                <li class="first-line">
                    <a href="<?php echo wp_login_url( get_permalink() ); ?>">Log in</a> or
                    <a href="<?php echo site_url( 'register' ); ?>">join the community</a>
    <?php } ?>

If the user is logged in, it displays a box like this: Display when user is logged in

If the user is logged out, it displays a line of text like this: Display when user is logged out

  • Something is missing from the top line it doesn't begin with anything, i don't think that will work Mar 3, 2012 at 1:08
  • The only thing that might be missing is an opening <?php tag (which I've now added). But this code will do exactly what I say it will - I copied it from a live site and used the life site to make the screenshots at the bottom of my answer. Have you at least attempted to implement this answer?
    – EAMann
    Mar 3, 2012 at 3:21

A quick note that @EAMann's answer isn't BuddyPress-specific. If you want to point to the user's BP profile edit page instead of the WP Dashboard version, replace

admin_url( 'profile.php' )



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