The MU forums have moved to WordPress.org

make a login form in public blog page (index.php) (3 posts)

  1. thtang
    Member
    Posted 17 years ago #

    I have added a login form with reference to the wp-login.php.

    <form name="loginform" id="loginform" action="http://domain-name/wp-login.php" method="post">
    
    	<p>
    		<label><?php _e('Username:') ?><br />
    		<input type="text" name="log" id="user_login" class="input" value="<?php echo attribute_escape(stripslashes($user_login)); ?>" size="20" tabindex="10" /></label>
    	</p>
    	<p>
    		<label><?php _e('Password:') ?><br />
    		<input type="password" name="pwd" id="user_pass" class="input" value="" size="20" tabindex="20" /></label>
    	</p>
    <?php do_action('login_form'); ?>
    	<p><label><input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="90" /> <?php _e('Remember me'); ?></label></p>
    	<p class="submit">
    		<input type="submit" name="wp-submit" id="wp-submit" value="<?php _e('Login'); ?> &raquo;" tabindex="100" />
    		<input type="hidden" name="redirect_to" value="<?php echo attribute_escape($redirect_to); ?>" />
    	</p>
    </form>

    However, i got a problem that it only directs to wp-login.php but not redirecting back to wp-admin.php. After i back the page, i found that the user is logged in, that means my form is working... but only not knowing to redirect to the admin panel like the normal login procedures do.

    Please advice.

    Thank you.

  2. lunabyte
    Member
    Posted 17 years ago #

    Take out the hidden input field.

  3. drmike
    Member
    Posted 17 years ago #

    I was wondering about that as well since I don't have it on my site and the example I put up at trac doesn't include one.

About this Topic