WordPress.org

Ready to get started?Download WordPress

Forums

Logged out everytime I tried to post comment (8 posts)

  1. achaykiller
    Member
    Posted 3 years ago #

    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)

  2. esmi
    Theme Diva & Forum Moderator
    Posted 3 years ago #

    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?

  3. achaykiller
    Member
    Posted 3 years ago #

    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"); ?>
  4. esmi
    Theme Diva & Forum Moderator
    Posted 3 years ago #

    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"); ?>
  5. achaykiller
    Member
    Posted 3 years ago #

    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?

  6. achaykiller
    Member
    Posted 3 years ago #

    i can still post comments via the dashboard, though.

  7. achaykiller
    Member
    Posted 3 years ago #

    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? :)

  8. achaykiller
    Member
    Posted 3 years ago #

    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? :)

Topic Closed

This topic has been closed to new replies.

About this Topic