Support » Fixing WordPress » Logged out everytime I tried to post comment

  • hey guys!

    i’ve made a new theme and it’s having problem with the comment part. my posts require users to be registered and logged in before they can post a comment.

    problem is, i am logged in, and every time i try to post a comment, i am logged out and directed to the wordpress admin login page.

    i checked my code to see what’s wrong, but i can’t seem to figure it out 🙁 hope somebody can help me. i’m baffled! o_o

    (just an fyi, i am using the Login Redirect and Subscribe to Comment plugins)

Viewing 7 replies - 1 through 7 (of 7 total)
  • esmi

    (@esmi)

    Forum Moderator

    Have you tried:

    – deactivating all plugins to see if this resolves the problem? If this works, re-activate the plugins one by one until you find the problematic plugin(s).

    – switching to the default theme to rule out any theme-specific problems?

    ayt, checked it already. nothing wrong with the plugins, but definitely with my theme! i wonder what did i missed. here’s my single.php code:

    <?php include("top.php"); ?>
    <div id="content">
    <?php include("sideryt.php"); ?>
    <div class="blogposts">
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="title_single"><?php the_title(); ?>
    <span class="single_edit"><?php edit_post_link('(Edit this Post?)'); ?></span></div>
    <div class="posty_single"><?php the_content(); ?></div>
    <?php endwhile; ?>
    <div class="single_comments"><?php comments_template(); ?></div>
    <?php else: ?>
    <div class="title"><?php _e('No Content.') ?></div>
    <?php endif; ?>
    </div>
    <?php include("footer.php"); ?>
    esmi

    (@esmi)

    Forum Moderator

    Try:

    <?php include("top.php"); ?>
    <div id="content">
    <?php include("sideryt.php"); ?>
    <div class="blogposts">
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="title_single"><?php the_title(); ?>
    <span class="single_edit"><?php edit_post_link('(Edit this Post?)'); ?></span></div>
    <div class="posty_single"><?php the_content(); ?></div>
    <div class="single_comments"><?php comments_template(); ?></div>
    <?php endwhile; ?>
    <?php else: ?>
    <div class="title"><?php _e('No Content.') ?></div>
    <?php endif; ?>
    </div>
    <?php include("footer.php"); ?>

    thank you for that suggestion, esmi! i gave it a try, but i ended up with the same result. still logged out every time i hit the submit button, whether i used admin account or subscriber.

    i compared it with my other working themes, and nothing seems to be off. any other workarounds?

    i can still post comments via the dashboard, though.

    i finally figured out why.

    it seems that my logout button is causing this. this was the code that caused it:

    <form name="loginform" id="loginform" action="<?php echo wp_logout_url(); ?>" method="post">
    <input class="btnlogged" type="submit" name="wp-submit" id="wp-submit" value="<?php wp_loginout(); ?>" />

    the problem went away when i replaced it with a much simpler <?php wp_loginout(); ?>. not as nifty-looking as the first one, but i’m still working on it. any ideas? 🙂

    i finally figured out why.

    it seems that my logout button is causing this. this was the code that caused it:

    <form name="loginform" id="loginform" action="<?php echo wp_logout_url(); ?>" method="post">
                <input class="btnlogged" type="submit" name="wp-submit" id="wp-submit" value="<?php wp_loginout(); ?>" />

    the problem went away when i replaced it with a much simpler <?php wp_loginout(); ?>. not as nifty-looking as the first one, but i’m still working on it. any ideas? 🙂

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Logged out everytime I tried to post comment’ is closed to new replies.