[wp-trac] [WordPress Trac] #61746: WordPress login redirect issue
WordPress Trac
noreply at wordpress.org
Wed Jul 24 19:09:31 UTC 2024
#61746: WordPress login redirect issue
-----------------------------+-----------------------------
Reporter: dipakparmar2007 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 6.6.1
Severity: critical | Keywords:
Focuses: |
-----------------------------+-----------------------------
if ( isset( $_POST['action'] ) && $_POST['action'] == 'log-in' ) {
$user_login = $_POST['user_login'];
$password = $_POST['password'];
$user_data = array(
'user_login' => $user_login,
'user_password' => $password,
'remember' => true
);
$user = wp_signon( $user_data );
if ( ! is_wp_error( $user ) ) {
$user_id = $user->ID;
if ( $user_id ) {
$url = site_url().'/dashboard/';
wp_redirect( $url );
exit;
}
} else {
$error_message = $user->get_error_message();
}
}
<form action="" method="post" class="sign-in">
<div class="form_group">
<label for="user_login"><?php
_e('Username'); ?></label>
<input type="text"
name="user_login" class="input_control" id="user_login" value="" />
</div>
<div class="form_group">
<label for="password"><?php
_e('Password'); ?></label>
<input type="password"
class="input_control" name="password" id="password" />
</div>
<div class="forgot"><a href="<?php
echo site_url(); ?>/forgot-password/">Forgot Password?</a></div>
<div class="form_footer">
<button type="submit"><?php
_e('Log in'); ?></button>
<input type="hidden" name="action"
value="log-in" />
</div>
</form>
--
Ticket URL: <https://core.trac.wordpress.org/ticket/61746>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list