WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Redirect login failure to another page (4 posts)

  1. alkafy
    Member
    Posted 6 years ago #

    Hello again, my favorite community.

    Here's my trouble:

    I can't remember where I picked up the code just now, but I've got a sidebar login box across all pages, and the form action points to wp-login.php. Not surprisingly, when a user's login is successful, the page is refreshed and they're logged in. When it fails, they're sent to wp-login.php with the appropriate error.

    However, I'd really like to redirect a failed login to a different page instead of wp-login. I'm using Muhammad Haris' Login/Registration templates to streamline the look of my site, and the failed login redirect is the last remaining frontier. I was hoping to avoid modifying the core, but I'm willing to if it can't be avoided.

    I poked around in the forum search and couldn't find anything on this issue, so I'd vastly appreciate any help. Thank you!

  2. alkafy
    Member
    Posted 6 years ago #

    To clarify, here is my sidebar login code:

    <form action="<?php bloginfo('url') ?>/wp-login.php" method="post">
    
    <div id="reg_or_login">
    	<a href="<?php bloginfo('url') ?>/register">Register</a> or Log in:
    </div>
    
    <div id="user_prompt">
    	Username: <label for="log"><input type="text" name="log" id="log" value="<?php echo wp_specialchars(stripslashes($user_login), 1) ?>" size="13" /> </label>
    </div>
    
    <div id="pwd_prompt">
    	Password: <label for="pwd"><input type="password" name="pwd" id="pwd" size="13" /> </label>
    
    	<input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>"/>
    </div>
    
    <div style="display: inline;" class="buttons">
    	<button type="submit" style="font-size: 1em; display: inline; float: none;" class="">
    		<img src="<?php bloginfo('stylesheet_directory'); ?>/images/icons/group_key.png" alt=""/>
    Login
    	</button>
    </div>
    
    <div id="lost_pwd">
    	<a href="<?php bloginfo('url') ?>/lost-password">Lost Password?</a>
    </div>
    
    <div class="breakfree"></div>
    </form>
  3. alkafy
    Member
    Posted 6 years ago #

    Here are the templates I'm using for login/register/lost password:

    http://www.mharis.net/2008/01/18/wordpress-login-and-registration-templates/

  4. ollerwe
    Member
    Posted 6 years ago #

    I have the same question.
    Since my site http://www.swed.info/wp_cast is "members only", people without registration can not break the circle and keep going back to the site adress and therefor automatically to the login form again.
    Is there any form to change the home or site adress to a contact page or other within or ouside the blog?
    Regards
    Erico

Topic Closed

This topic has been closed to new replies.

About this Topic