Jump to content

Recommended Posts

Posted

Hey,

 

In the top right hand corner of my site, http://borealtrek.com, there is a spot for users to login or register. When the user does this those links still appear. This is very redundant and kind of confusing for them. Is there any way to have it so that when they login it shows them their username which is linked to their information ect.

 

Thanks for the help!

 

This is what it looks like now.

 

This is what I want it to look like.

Posted

In your template file, put this (where appropriate):

 

<?php
$current_user = wp_get_current_user();
if ( 0 == $current_user->ID ) {
   ?>
Login | Register
   <?php
} else {
   ?>
"<?php echo $current_user->user_login; ?>"
   <?php
}
?>

  • Like 1
Posted

Thank you man you did me a great favor! It all works well except for one thing. When the username shows up on the site it is not a link to the users info and ect. Any idea on how to do that? :D

Posted

Never mind that. I got it to work. lol I assumed html was much different from php. I did not know the two worked together.

 

$current_user = wp_get_current_user();

if ( 0 == $current_user->ID ) {

?>

<a href="http://borealtrek.com/wp-login.php">Login</a><a> | </a> <a href="http://borealtrek.com/wp-login.php?action=register">Register</a>

<?php

} else {

?>

<?php echo $current_user->user_login;?><a> | </a> <a href="http://borealtrek.com/wp-admin/profile.php">Settings</a>

<?php

}

?>

</li>

</ul>

<?php }

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...