For quite some time I thought WordPress wasn’t setting the comment cookies properly, because when I made comments the fields wouldn’t remain populated after I commented. I finally realized that if you’re logged in, you don’t have to worry about the fields at all because it pulls the name, e-mail address and URL from the user profile. This wasn’t very intuitive and the values still could have been filled in to the fields, but I realized that my theme just needed to exclude the name, e-mail and URL field if the user was logged in.
I believe there are lots of themes out there that would benefit from this change.
To update a theme, just use the conditional provided at the bottom of the get_currentuserinfo() page on the WordPress Codex.
Here’s what I added to my theme.
<?php if ('' == $user_ID) { ?> . . . (The Name, E-mail and URL fields) <?php } ?>
That works, but PHP would probably recommend the following:
. . . (The Name, E-mail and URL fields)
Haha, it’s not letting me post any php code… but what I posted was to change the following:
if (” == $user_ID)
to
if (!isset($user_ID))
Both would work, but the latter is more PHP efficient.
Chad: Thanks for the correction. I usually use isset() in my code, but took their example from the codex.