Wordpress Tip: A Custom Welcome Message for your Users

Published March 29, 2008 0 Comments 1 Delicious Bookmarks

I recently published an article over at WPDesigner that gave detailed instructions on how to create a Wordpress backed membership community. A working community site will have it’s members returning every so often to log in and update their information. A simple way to encourage this behavior is to display a custom welcome message (something that WP doesn’t natively do) whenever an already-logged-in member revisits your site.

In the example below I display a default message encouraging new sign ups, but whenever an already registered and signed in member is on the site, it shows them a welcome message using their username and encourages them to edit their profile.

<?php if (is_user_logged_in()) { ?>

<div class="acct-signedin">
   <p>Hello <?php global $user_login; get_currentuserinfo(); echo $user_login; ?> |
   <a href="<?php bloginfo('url'); ?>/wp-admin/profile.php">Edit your profile</a>,
   <a href="<?php bloginfo('url'); ?>/wp-login.php?action=logout">Sign out</a></p>
</div>

<? } else { ?>

<div class="acct-signedout">
   <p><a href="<?php bloginfo('url'); ?>/wp-register.php">Create an Account</a> |
   Already a member? <a href="<?php bloginfo('url'); ?>/wp-login.php">Sign in</a></p>
</div>

<? }; ?>

Leave your Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Get your own Gravatar