Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm using the following to let the user login:

       <form name='loginform' id='loginform' action='<?php echo get_settings('siteurl')?>/wp-login.php' method='post'>
                <label>User:</label><br />
                <input type='text' name='log' id='user_login' class='input' tabindex='20' /><input type='submit' name='wp-submit' id='wp-submit' value='Login' tabindex='23' /><br />
                <label>Pass:</label><br />
                <input type='password' name='pwd' id='user_pass' class='input' tabindex='21' />
                <span id="forgotText"><a href="<?php echo get_settings('siteurl')?>/wp-login.php?action=lostpassword"><?php _e('Forgot')?>?</a></span><br />
                <?php //echo "<input name='rememberme' type='hidden' id='rememberme' value='forever' />";?>
                <?php echo wp_register('',''); ?>
                <input type='hidden' name='redirect_to' value='<?php echo htmlspecialchars($_SERVER['REQUEST_URI'])?>' />
            </form>
            <?php
            global $opt_jfb_hide_button;
            if( !get_option($opt_jfb_hide_button) )
            {
                jfb_output_facebook_btn();
                //jfb_output_facebook_init(); This is output in wp_footer as of 1.5.4
                jfb_output_facebook_callback();
            }
?>

But it stays in the same page, how can I redirect the user to the home page?

share|improve this question
1  
Consider checking out Peter's login redirect for custom login redirection. –  t31os Mar 17 '11 at 11:36

2 Answers 2

up vote 3 down vote accepted

I'm going to venture a guess here, and maybe someone more versed can back me up or set me straight

But here:

<?php echo htmlspecialchars($_SERVER['REQUEST_URI'])?>'

Is the redirect value.... It is redirecting to the original url, wherever the user came from

If you swap that out for your home url with something like:

<?php echo home_url( '/' ); ?>

I would think that would do it

share|improve this answer
    
That's practically what i was about to post in my own answer, so i've +1'ed you instead. :) –  t31os Mar 17 '11 at 11:30
    
Thanks for that! Good to know.... must be good coffee this morning! –  Rev. Voodoo Mar 17 '11 at 11:31
    
There is nothing like a good morning coffee. +1 for the coffee and good job on the answer. –  Bainternet Mar 17 '11 at 11:56

The plugin way to do this is use Login with Ajax. I think you can specify different URLs for different user levels after logging and registration actions.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.