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.

Categories
General

Fixing the sidebar

When the option to list the posts containing an image is turned on the default WordPress sidebar template thinks an image page in the Photopress album is a search page (it is – that’s how we know if an image is used in a post). While correct, this makes the sidebar ugly. But it’s such a neat feature, it’d be a shame to disable it. Here’s how to fix the default template’s sidebar.php:

1. Look for is_search() and add && empty($_GET['pp_image']) to that elseif statement. (this suppresses the search stuff when it’s displaying an image)

2. look for is_home() and add || !empty($_GET['pp_image']) to that if statement. (this shows the normal homepage sidebar when it’s an image)

Here’s a zipped replacement sidebar.php if you don’t want to do this yourself.