• Resolved aslee

    (@aslee)


    After upgrading to 2.3.2 (from the initial 2.3 release) I notice that comments.php will… well, $user_ID does register, and $user_identity returns the correct name, but trying to post comments from a logged-in user gives me <b>Error: please fill the required fields (name, email).</b>

    I’m not sure if this is a bug or not (I’m using Brian’s Threaded Comments, tweaked to recognize logins), but I tried disabling it and reverting to the standard comments.php, which leaves the same problem.

    As a hack, I’m trying to graft on some <input type="hidden"> tags to the login block to make it pull the information automagically. $user_identity is easy, but I can’t figure out how to get $user_email – I tried value="<?php echo $user_email>" but that comes up blank for some reason.

    Has anyone else come across this problem? If I’m alone, does anyone know how to finish my hack?

Viewing 1 replies (of 1 total)
  • Thread Starter aslee

    (@aslee)

    I’m still not sure why this fails on the default theme and such, but I did work a hack up to get around it. In comments.php there is a piece of code that looks something like this:

    < ?php if ( $user_ID ) : ?>
       <p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"> < ?php echo $user_identity; ?></a>. <br /> <a href="<?php echo get_option(’siteurl’); ?>/wp-login.php?action=logout" title="Log out of this account">Logout &raquo;</a></p>
    < ?php else : ?>

    I changed it to look like this instead:

    < ?php if ( $user_ID ) : ?>
       < ?php global $user_email; global $user_url; get_currentuserinfo(); ?>
       <p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"> < ?php echo $user_identity; ?></a>. <br /> <a href="<?php echo get_option(’siteurl’); ?>/wp-login.php?action=logout" title="Log out of this account">Logout &raquo;</a></p>
    		<input type="hidden" name="author" id="author" value="<?php echo $user_identity; ?/>" />
    		<input type="hidden" name="email" id="email" value="<?php echo $user_email; ?/>" />
    		<input type="hidden" name="url" id="url" value="<?php echo $user_url; ?/>" />
    < ?php else : ?>

    Note the < ?php global $user_email; global $user_url; get_currentuserinfo(); ?> along with the input type="hidden" fields. It initializes $user_url and $user_email so that you can reference them.

    I don’t think author/email/url will need changing to fit themes, but I could be wrong.

Viewing 1 replies (of 1 total)
  • The topic ‘Comments.php not recognizing login properly after upgrade’ is closed to new replies.