• Resolved baal666

    (@baal666)


    Hi,

    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:

    <?php
    /**
     * @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>
    	<?php
    		return;
    	}
    ?>
    
    <!-- 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)); ?>
    	</ol>
    
    	<div class="navigation">
    		<div class="alignleft"><?php previous_comments_link() ?></div>
    		<div class="alignright"><?php next_comments_link() ?></div>
    	</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>
    </div>
    
    <?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>.
    	</p>
    
    <?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(); ?>
    </p>
    <?php do_action('comment_form', $post->ID); ?>
    
    </form>
    </div>
    
    <?php endif; // If registration required and not logged in ?>
    
    <?php endif; // if you delete this the sky will fall on your head ?>

    Thanks!

Viewing 13 replies - 1 through 13 (of 13 total)
  • Thread Starter baal666

    (@baal666)

    *Bump*

    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?

    Thanks

    2.7 to much Comment problem!!

    [signature moderated Please read the Forum Rules]

    Thread Starter baal666

    (@baal666)

    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?

    Thanks

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    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 https://wp.dembowski.net/wp-content/comments.txt (rename it to comments.php…)

    Append to your theme’s style.css this file https://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.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    Clear your cookies and re-login.

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

    Thread Starter baal666

    (@baal666)

    Hi,

    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.

    Thread Starter baal666

    (@baal666)

    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…

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    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.

    Thread Starter baal666

    (@baal666)

    Thanks for the help! ??

    I still don’t understand why it works and in what those three keys are important… but it works! ??

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    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.

    Thread Starter baal666

    (@baal666)

    @otto42: How can I do this?

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

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

    Dunno about other browsers.

    Thread Starter baal666

    (@baal666)

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

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Comment form showing even when logged in!’ is closed to new replies.