WordPress.org

Ready to get started?Download WordPress

Forums

loginout and "redirect to" (4 posts)

  1. thenige
    Member
    Posted 8 years ago #

    Could this funciton adjusted to return you to the page where ou called it from. For the most part protectyed pages (for example the wp-admin pages) are redirected to the the login and then back... however, if you use the wp_loginout function in your theme, you end up on the dashboard, not at the main page of your site.

    an option to do this would be a good thing, or support for a plugin to control it???

  2. whooami
    Member
    Posted 8 years ago #

    Ive done it :) login and youre redirected back to blog AND it "tells" you that youre logged in.
    Short answer: yes it can be done

  3. devilmaycry
    Member
    Posted 8 years ago #

    whooami,

    Would you care to share this information at all?

  4. war59312
    Member
    Posted 8 years ago #

    Add this to your side bar. :D

    However, I still cant figure out how to make it so when you logoff and go to back to page you came from, that is, its ignoreing "action=logout&redirect_to=" . :( Any ideas?

    <?php
    global $user_ID, $user_identity;
    get_currentuserinfo();
    if (!$user_ID):
    ?>
    <h2><?php _e('Sign In'); ?></h2>
    <ul style="text-align: center;">
    <li>

    <form name="loginform" id="loginform" action="<?php echo get_settings('siteurl'); ?>/wp-login.php" method="post">
    <div><label style="color:red"><?php _e('User Name') ?>:<br /> <input type="text" name="log" id="log" value="" size="20" tabindex="7" /></label><br /><br />
    <label style="color:red"><?php _e('Password') ?>:<br /> <input type="password" name="pwd" id="pwd" value="" size="20" tabindex="8" /></label><br /><br />
    <input type="submit" name="submit" value="<?php _e('Sign In'); ?> &raquo;" tabindex="9" />
    <input type="hidden" name="redirect_to" value="<?php echo convert_chars($_SERVER['REQUEST_URI']); ?>"/></div>
    </form>
    </li>
    </ul>

    <?php
    else:
    ?>
    <h2><?php echo $user_identity; ?></h2>
    <ul style="text-align: center;"><li>
    <a href="<?php echo get_settings('siteurl') . '/wp-login.php?action=logout&amp;redirect_to=' . $_SERVER['REQUEST_URI']; ?>" title="Sign Out"><?php _e('Sign Out'); ?></a>
    </li>
    </ul>
    <?php
    endif;
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic