WordPress.org

Ready to get started?Download WordPress

Forums

Redirection After Login (2 posts)

  1. fi3ryfalc0nZ
    Member
    Posted 3 years ago #

    Hi,
    I have some problems with the redirection codings. I set the code such a way that it will redirect me to the current page I am in. It works for other pages, except for the frontpage. Whenever I login from the frontpage, it redirects me to my latest post. My coding is as follows:

    <?php
    if ( is_user_logged_in() ) : ?>
    <p style="margin-left:12px;">Welcome back, <?php global $current_user; get_currentuserinfo(); echo '' . $current_user->user_login . "\n"; ?> | <a href="<?php echo wp_logout_url().'&action=logout&redirect_to='.$_SERVER['REQUEST_URI']; ?>" title="Log out of this account">Logout</a></p>
    <?php else : ?>
    <p style="margin-left:12px;"><a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php echo get_option('siteurl'); ?>" class="simplemodal-login">Login</a> | <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=register" class="simplemodal-register">Register</a></p>
    <?php endif; ?>

    For your information, I'm using Simplemodal Login and SimpleCaptcha for ease of access. Please do assist.

    Regards,
    Sean

  2. fi3ryfalc0nZ
    Member
    Posted 3 years ago #

    I meant this code:

    <?php
    if ( is_user_logged_in() ) : ?>
    <p style="margin-left:12px;">Welcome back, <?php global $current_user; get_currentuserinfo(); echo '' . $current_user->user_login . "\n"; ?> | <a href="<?php echo wp_logout_url().'&action=logout&redirect_to='.$_SERVER['REQUEST_URI']; ?>" title="Log out of this account">Logout</a></p>
    <?php else : ?>
    <p style="margin-left:12px;"><a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php the_permalink(); ?>" class="simplemodal-login">Login</a> | <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=register" class="simplemodal-register">Register</a></p>
    <?php endif; ?>

    I was using the previous code for temporary measure to redirect all my users to the frontpage.

Topic Closed

This topic has been closed to new replies.

About this Topic