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. Quote
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 Quote
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? Quote
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 Quote
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 } Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.