npl Posted December 5, 2011 Posted December 5, 2011 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.
Guest xaav Posted December 5, 2011 Posted December 5, 2011 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 } ?> 1
npl Posted December 5, 2011 Author Posted December 5, 2011 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?
maths222 Posted December 5, 2011 Posted December 5, 2011 (edited) When logged in, a user bar appears at the top of the page. You could just make this link disappear when a user is logged in. Edited December 5, 2011 by maths222
npl Posted December 5, 2011 Author Posted December 5, 2011 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 }
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now