Reputation: 521
I am building a wordpress website and using buddypress plugin for community building.I added profile menu of buddypress from menu options in the dashboard. Profile menu of buddypress only shows "profile" in the menu.How can i change the profile to show username and profile photo.
I can use bp_loggedin_user_avatar('width='.bp_core_avatar_thumb_width(). '&height='.bp_core_avatar_thumb_height());
for displaying buddypress profile photo and $current_user = wp_get_current_user(); echo $current_user->display_name;
for displaying username.
But i don't know where to use this code to change profile menu to display username and user photo.
Thanking you in advance.
Upvotes: 0
Views: 1764
Reputation: 1108
Don't set in dashboard-> appearance -> menu
Use below code in header.php,
<?php if( is_user_logged_in() ) {
$user = wp_get_current_user(); ?>
<li class="profile-icon-sec">
<?php echo get_avatar( $user->ID, 38 ); ?>
<span class="profile-name"><b>John Stephen</b> <img src="<?php echo get_template_directory_uri(); ?>/images/arrow-point-to-right.png" alt="" /></span>
</li>
<ul class="dropdown-menu avatar-dropdown-menu">
<li class="dropdown-avatar-list"> <a href="<?php echo home_url().'/members/'.$user->user_login; ?>/"> My Account</a></li>
<li class="dropdown-avatar-list"> <a href=" <?php echo wp_logout_url( home_url() ); ?>"> Logout</a></li>
</ul>
<?php } else {?>
<li class="login-btn">
<a class="btn" href="<?php echo home_url(); ?>/login/">Login</a>
</li>
<?php } ?>
Upvotes: 1