[resolved] Comment form showing even when logged in! (14 posts)

  1. baal666
    Posted 7 years ago #


    I have this problem: even when I am logged in, I still need to enter my name, email, etc. before sending a comment.

    How to arrange this?

    Here is my code:

     * @package WordPress
     * @subpackage cdharrison
    // Do not delete these lines
    	if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
    		die ('Please do not load this page directly. Thanks!');
    	if ( post_password_required() ) { ?>
    		<p class="nocomments">This post is password protected. Enter the password to view comments.</p>
    <!-- You can start editing here. -->
    <?php if ( have_comments() ) : ?>
    	<h3 id="comments"><?php comments_number('Aucun commentaire', 'Un commentaire', '% commentaires' );?> agrave; “<?php the_title(); ?>”</h3>
    	<ol class="commentlist">
    	<?php wp_list_comments(array('avatar_size'=>32)); ?>
    	<div class="navigation">
    		<div class="alignleft"><?php previous_comments_link() ?></div>
    		<div class="alignright"><?php next_comments_link() ?></div>
     <?php else : // this is displayed if there are no comments so far ?>
    	<?php if ('open' == $post->comment_status) : ?>
    		<!-- If comments are open, but there are no comments. -->
    	 <?php else : // comments are closed ?>
    		<!-- If comments are closed. -->
    		<p class="nocomments">Comments are closed.</p>
    	<?php endif; ?>
    <?php endif; ?>
    <?php if ('open' == $post->comment_status) : ?>
    <div id="respond">
    <h3><?php comment_form_title( 'Laissez un commentaire', 'Laissez un commentaire &agrave; %s' ); ?></h3>
    <div class="cancel-comment-reply">
    	<small><?php cancel_comment_reply_link(); ?></small>
    <?php if ( get_option('comment_registration') && !$user_ID ) : ?>
    <p>You must be <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php echo urlencode(get_permalink()); ?>">logged in</a> to post a comment.</p>
    <?php else : ?>
    <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
    	<?php if ($user_ID) : ?>
    	<p>Vous &ecirc;tes connect&eacute; en tant que <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="Se d&eacute;connecter">Se d&eacute;connecter</a>.
    <?php else : ?>	
    <p><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?> />
    <label for="author"><small>Nom <?php if ($req) echo "(required)"; ?></small></label></p>
    <p><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?> />
    <label for="email"><small>Courriel (ne sera pas publi&eacute;) <?php if ($req) echo "(required)"; ?></small></label></p>
    <p><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" />
    <label for="url"><small>Site web</small></label></p>
    <?php endif; ?>
    <!--<p><small><strong>XHTML:</strong> You can use these tags: <code><?php echo allowed_tags(); ?></code></small></p>-->
    <p><textarea name="comment" id="comment" cols="100%" rows="10" tabindex="4"></textarea></p>
    <p><input name="submit" type="submit" id="submit" tabindex="5" value="Soumettre" />
    <?php comment_id_fields(); ?>
    <?php do_action('comment_form', $post->ID); ?>
    <?php endif; // If registration required and not logged in ?>
    <?php endif; // if you delete this the sky will fall on your head ?>


  2. baal666
    Posted 7 years ago #


    I can't edit my posts from the single.php also.. It seems it does not recognize I am logged in anymore. Anyone can help?


  3. rsaman12
    Posted 7 years ago #

    2.7 to much Comment problem!!

    [signature moderated Please read the Forum Rules]

  4. baal666
    Posted 7 years ago #

    I'd like to add that even when I write a comment it seems it does not recognize I am the author anymore. Anyone can help?


  5. I took your code and placed it all in my comments.php (I renamed my existing one and saved it).

    Your code worked perfectly for me. I was able to click on edit, reply, cancel reply, etc. and I had gotten the expected results. The only thing that was different was that my CSS was not set up for your code.

    Everything worked, it just looked horrible. I suspect something else is going on.

    Try this: Backup your theme's files and download and replace your comments.php with this one http://wp.dembowski.net/wp-content/comments.txt (rename it to comments.php...)

    Append to your theme's style.css this file http://wp.dembowski.net/wp-content/comments-style.txt

    The styling was taken from Chris's excellent web page. The comments were butchered by me using Otto's instructions.

    Make sure that in your header.php you have that if singular statement from Otto's page.

    Load up your page and let me know if that works.

  6. Clear your cookies and re-login.

    Also, clear your browser cache, and if you're using it, your wp-super-cache.

  7. baal666
    Posted 7 years ago #


    And thanks for your help jdembowski and Otto42!

    I realize that I should have given more information about the problem. I think jdembowski is right: the comments.php file is not the problem.

    The problem is that when I click to "log in" in my sidebar and enter my information, I can correctly access the admin panel. So far, everything is fine. But when I click on the link from the admin panel that goes to my blog, I don't see "logged in as..." but I still see the "log in" text that invites me to log in again, and if I try to do whatever from there I am considered as a guest rather than been logged in.

    As an example, I used to see a "Edit" below posts (only visible to the author) but now it's gone. I really am a guest on my own blog...

    This is as precise as my poor English skills can get me so far.

    Thank you for your help. I wish I could help some people someday as well as I received help from many here.

  8. baal666
    Posted 7 years ago #

    Problem solved!

    Here is what I did, if someone has the same problem:

    I simply opened wp-config and wrote three sentences for the first three keys there. I have absolutely NO idea what those keys are for (if anyone would like to explain to me why this solved my problem I would appreciate) but now my site works well...

  9. EDIT: Laughter. I posted this reply before I saw you "Problem solved" :)

    Well the old troubleshooting may work: disable your plugins, revert to the default theme and see if that solves the problem of having the edit links return.

    If that does solve the problem, put the theme back and start re-activating the plugins until the problem comes back. That should help you identify the source of the problem.

    If you have a caching plugin, save that for last.

  10. baal666
    Posted 7 years ago #

    Thanks for the help! :)

    I still don't understand why it works and in what those three keys are important... but it works! :)

  11. Changing those three keys invalidates all your previous cookies, so it has the same effect as clearing your cookies, basically.

    I'd still clear your cookies, or you may find the problem recurs in a couple weeks.

  12. baal666
    Posted 7 years ago #

    @Otto42: How can I do this?

  13. In Firefox it's Tools->Clear Private Data. Select just the cookies and hit the clear button.

    Dunno about other browsers.

  14. baal666
    Posted 7 years ago #

    Thanks. I do it pretty often; I thought it was something else.

Topic Closed

This topic has been closed to new replies.

About this Topic