In this tutorial I will show you how you can create a cool member bar on your Thesis site that will:
- Show a login link to visitors who are not logged in
- Upon logging in, redirects users to the same page they were on
- Show logout link to logged in users
- Show links to dashboard, user profile and so on
- Show gravatar of the logged in user
Coolness aside, it is a great way to present the more frequently used admin links right on the frontend so that the casual contributor doesn’t have to find his way out through a complicated dashboard interface! This is particularly useful for multi-author blogs.
I prefer to place the member links at the very top, in the Thesis header above the navigation menu, as seen on Bong Buzz. With the following code you can achieve that. You may also want to place it in the sidebar or footer for which you need to call the function in the appropriate hook - should be easy if you are acquainted with Thesis hooks - and modify the HTML and CSS accordingly. You can also add a welcome message to greet your users once they log in.
Although this guide is written keeping Thesis users in mind, it is applicable to any WordPress theme as well. A generalised code for any WordPress theme is given at the end of this post.
Let’s start defining a function and name it ‘memberbar’.
function memberbar() {
if ( is_user_logged_in() ) { ?>
<ul class="login">
<?php global $user_email;
echo get_avatar($user_email, 13);?>
<li><a href="/wp-admin/profile.php" title="User Profile"><?php global $current_user;
get_currentuserinfo();
echo($current_user->user_firstname . " " . $current_user->user_lastname . "");
?></a></li>
<li><a href="/wp-admin/post-new.php" title="Write New Post">Write</a></li>
<li><a href="/wp-admin/" title="Dashboard">Dashboard</a></li>
<li class="noborder"><a href="<?php echo wp_logout_url( get_permalink() ); ?>" title="Logout">Logout</a></li>
</ul>
<?php
} else {
?>
<ul class="login"><li class="noborder"><a href="<?php echo wp_login_url( get_permalink() ); ?>" title="Login">Login</a></li></ul>
<?php }
}
Now you call the funtion ‘login’ we just created anywhere you wish the member bar to appear. Pretty neat, right?
function top_nav_menu() {?>
<div id="top_nav_menu">
<ul>
<li><a href="<?php echo get_bloginfo ('url'); ?>" title="Home">Home</a></li>
</ul>
<?php memberbar(); ?>
</div>
<?php
}
add_action('thesis_hook_before_header', 'top_nav_menu');
I am quoting the relevant portions from my CSS which will give you a member login bar similar to the one on bongbuzz.net. You should modify it as per your need, especially the measurements.
#top_nav_menu {
height:27px;
}
#top_nav_menu ul {
list-style-image:none;
list-style-type:none;
margin:0;
padding-top:7px;
padding-left:5px;
float:left;
}
#top_nav_menu li {
border-right: 1px solid #aaa;
display: inline;
text-decoration:none;
}
#top_nav_menu ul.login {
padding-left:0;
float:right;
padding-right:5px;
}
#top_nav_menu li.noborder
{
border-right: 0px;
}
#top_nav_menu li a {
padding:0 10px;
}
#top_nav_menu li a:hover {
text-decoration:underline;
}
Code for WordPress themes in general:
<div id="top_nav_menu">
<ul>
<li><a href="<?php echo get_bloginfo ('url'); ?>" title="Home">Home</a></li>
</ul>
<?php if ( is_user_logged_in() ) { ?>
<ul class="login">
<?php global $user_email;
echo get_avatar($user_email, 13);?>
<li><a href="/wp-admin/profile.php" title="User Profile"><?php global $current_user;
get_currentuserinfo();
echo($current_user->user_firstname . " " . $current_user->user_lastname . "");
?></a></li>
<li><a href="/wp-admin/post-new.php" title="Write New Post">Write</a></li>
<li><a href="/wp-admin/" title="Dashboard">Dashboard</a></li>
<li class="noborder"><a href="<?php echo wp_logout_url( get_permalink() ); ?>" title="Logout">Logout</a></li>
</ul>
<?php
} else {
?>
<ul class="login"><li class="noborder"><a href="<?php echo wp_login_url( get_permalink() ); ?>" title="Login">Login</a></li></ul>
<?php } ?>
</div>
Warning: Direct copy-pasting of code from this page can give you invalid characters.
Hope you find this useful. ![]()
Related Entries
-
HOW TO: Adsense Section Targeting In ThesisHOW TO: Meta Description & Keyword Tags On Author PagesCan’t Delete FB!How Well Do You Know Me?!Orkut Opens DoorsLoving the Group Chat in FBHow To Add A Network On Facebook?Trying Out The All New Sports BarMy favourite classBroadband for me

Great article. Straight forward and easy to follow instructions, I used this for thesis site and I am loving it. Nipon was also very helpful with answering all the technical questions I had. Thanks for sharing your sound knowledge on Thesis and Wordpress.
order clomid 50mg in canada unprescribed clomid infertility
order clomid 50mg in canada online without prescription with american express - results of clomid challenge test
Clomid is a mixture of two geometric isomers cis zuclomiphene and trans enclomiphene containing between 30% and 50% of the cis-isomer. Along with its needed effects, a medicine may cause some unwanted effects. Although not all of these side effects may occur, if they do occur they may need medical attention. Clomid is the most very simple prescribed fertility is on is market today. And that the because it is not only very routinely to take pill pattern, not injections of because it is so productive as well. 80% it. women who take Clomid to help them to ovulate do ovulate and 40-45% but those likely get with child in their first 6 circuits utilising of Because 25% of feminine infertility is because of a woman either not ovulating or not ovulating frequently, Clomid pharmaceutical women the
order hcg clomid 50mg in canada clomid and twins nursing journals
i want to download latest movies but i dont know the right websites, there are some websites which offer links in mediafire but their movies is being divided into many parts. Im planning to download it in a whole or 2 parts but not with 4-7 parts. thank you in advance.