Categories
General

Sidebar login with extras

It’s nice to get registered users to log in as soon as they hit a group blog so they’re all set when they want to comment. Otherwise, when they comment they’re probably just going to fill out the form for non-users, triggering moderation and frustration. I figured that a sidebar login form might do the trick. Lucky for me, I found a nice tutorial at wpdesigner.com to do exactly that. Unfortunately, it wasn’t quite up to date, using user levels instead of capabilities, and lacking the new nonce-ified wp_logout_url.

Here’s what my login form looks like:

loggedin

And when a user is logged in:

loginform

Download the updated sidebar_login.txt to modify and use in your own sidebar. Again, thanks to wpdesigner.com for showing where to start!

Update: I decided I prefer showing the display_name instead of user_login at the top of the sidebar. To switch just change $current_user->user_login to $current_user->display_name. You could also use some combination of the user’s first and last names – see the wp_get_current_user Codex page for details.

Avatar photo

By isaac

I like cats. he/him