Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if ( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == 'log-in' ) :
- global $error;
- $login = wp_login( $_POST['user-name'], $_POST['password'] );
- $login = wp_signon( array( 'user_login' => $_POST['user-name'], 'user_password' => $_POST['password'], 'remember' => $_POST['remember-me'] ), false );
- if (!$error) {
- save_message( 'success', __( 'You have successfully Login.', 'frontendprofile' ) );
- unset($_POST);
- wp_redirect( get_permalink( 4 ) );
- }
- // wp_redirect( home_url() );
- endif;
- <?php
- if ( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == 'log-in' ) :
- $login = wp_signon( array( 'user_login' => $_POST['user-name'], 'user_password' => $_POST['password'], 'remember' => $_POST['remember-me'] ), false );
- if ( !is_wp_error($login) ){
- save_message( 'success', __( 'You have successfully Login.', 'frontendprofile' ) );
- unset($_POST);
- wp_redirect( get_permalink( 4 ) );
- }
- endif;
- ?>
- <?php
- function parse_user($info = null, $return = 'object') {
- if ( is_null( $info ) ) {
- global $current_user;
- if ( empty( $current_user->ID ) ) return null;
- $info = get_userdata( $current_user->ID );
- }
- elseif ( empty( $info ) ) {
- return null;
- }
- if( $return == 'ID' ) {
- if ( is_object( $info ) ) return $info->ID;
- if ( is_numeric( $info ) ) return $info;
- }
- elseif( $return == 'object' ) {
- if ( is_object( $info ) && $info->ID) return $info;
- if ( is_object( $info )) return get_userdata( $info->ID );
- if ( is_numeric( $info ) ) return get_userdata( $info );
- if ( is_string( $info ) ) return get_userdatabylogin( $info );
- }
- else {
- return null;
- }
- }
- function wp_login_user_po9856($username, $password, $remember) {
- // Get the user based on the username from the POST
- $user = parse_user($username);
- // Remove html tags from the variables
- $username = strip_tags($username);
- $password = strip_tags($password);
- // Validate the Form Data
- if(!wp_check_password( $password_stripped, $user->user_pass ) ) return new WP_Error('incorrect_password', "Wrong Password!");
- // User login
- $login = wp_signon(array('user_login' => $username, 'user_password' => $password, 'remember' => (bool)$remember));
- if (is_wp_error($login))
- return $login;
- // Unset
- unset($_POST);
- // Custom Message
- save_message( 'success', __( 'You have successfully Login.', 'frontendprofile' ) );
- // Redirection
- wp_redirect(get_permalink( 4 ));
- }
- if ( 'POST' == $_SERVER['REQUEST_METHOD'] && @$_POST['action'] == 'log-in')
- {
- wp_login_user_po9856($_POST['user-name'], $_POST['password'], $_POST['remember-me']);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement