• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wp_signon函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wp_signon函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_signon函数的具体用法?PHP wp_signon怎么用?PHP wp_signon使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wp_signon函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: login

 /**
  * custom log in functionality, from custom log in page
  */
 static function login()
 {
     if (!isset($_POST[Kanban_Utils::get_nonce()]) || !wp_verify_nonce($_POST[Kanban_Utils::get_nonce()], 'login')) {
         return;
     }
     if (is_email($_POST['email'])) {
         $user = get_user_by('email', $_POST['email']);
         if (empty($user)) {
             Kanban_Flash::flash(__('Whoops! We can\'t find an account for that email address.', 'kanban'), 'danger');
             wp_redirect($_POST['_wp_http_referer']);
             exit;
         }
     } else {
         $user = get_user_by('login', $_POST['email']);
         if (empty($user)) {
             Kanban_Flash::flash(__('Whoops! We can\'t find an account for that username.', 'kanban'), 'danger');
             wp_redirect($_POST['_wp_http_referer']);
             exit;
         }
     }
     $creds = array();
     $creds['user_login'] = $user->user_login;
     $creds['user_password'] = $_POST['password'];
     $creds['remember'] = true;
     $user = wp_signon($creds, false);
     if (is_wp_error($user)) {
         Kanban_Flash::flash(__('Whoops! That password is incorrect for this email address.', 'kanban'), 'danger');
         wp_redirect($_POST['_wp_http_referer']);
         exit;
     }
     wp_set_current_user($user->ID);
     wp_set_auth_cookie($user->ID);
     wp_redirect(sprintf('%s/%s/board', site_url(), Kanban::$slug));
     exit;
 }
开发者ID:gigabyte1977,项目名称:kanban,代码行数:38,代码来源:class-user.php


示例2: loginUser

function loginUser($email, $password)
{
    if ($email !== null && $password !== null) {
        /**
         * @var \WegeTech\LottoYard\Service $lottoService
         */
        global $lottoService;
        $credentials = array();
        $credentials['user_login'] = $email;
        $credentials['user_password'] = $password;
        $credentials['remember'] = true;
        $user = wp_signon($credentials, false);
        if (is_wp_error($user)) {
            wp_send_json(array('data' => $user->get_error_message()));
        } else {
            $userData = new User();
            $lottoPass = get_user_meta($user->id, 'lottoPass', true);
            $userData->Email = $email;
            $userData->Password = $lottoPass;
            $response = $lottoService->loginUser($userData);
            session_start();
            $_SESSION['userData'] = $response->data;
            if ($response->success) {
                header('Location: http://wpjl.2hypnotize.com/');
            } else {
                wp_send_json(array('data' => $response->message));
            }
        }
    }
}
开发者ID:liroyti,项目名称:Jinnilotto,代码行数:30,代码来源:page-user.php


示例3: check_login

 function check_login()
 {
     $user = $this->share_session();
     if ($user) {
         wp_signon(array('user_login' => $user->username, 'user_password' => 'whatever'));
     }
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:7,代码来源:sso.php


示例4: process_registration

 public function process_registration()
 {
     do_action('popmake_alm_ajax_override_registration');
     $user_login = $_POST['user_login'];
     $user_email = $_POST['user_email'];
     $user_pass = isset($_POST['user_pass']) ? $_POST['user_pass'] : wp_generate_password(12, false);
     $userdata = compact('user_login', 'user_email', 'user_pass');
     $user = wp_insert_user($userdata);
     if (!isset($_POST['user_pass'])) {
         update_user_option($user, 'default_password_nag', true, true);
         // Set up the Password change nag.
         wp_new_user_notification($user, $user_pass);
     }
     if (is_wp_error($user)) {
         $response = array('success' => false, 'message' => $user->get_error_message());
     } else {
         if (popmake_get_popup_ajax_registration($_POST['popup_id'], 'enable_autologin')) {
             $creds = array('user_login' => $user_login, 'user_password' => $user_pass, 'remember' => true);
             $user = wp_signon($creds);
         }
         $message = __('Registration complete.', 'popup-maker-ajax-login-modals');
         if (!isset($_POST['user_pass'])) {
             $message .= ' ' . __('Please check your e-mail.', 'popup-maker-ajax-login-modals');
         }
         $response = array('success' => true, 'message' => $message);
     }
     echo json_encode($response);
     die;
 }
开发者ID:eugene-gromky-co,项目名称:mindfulnesssummit,代码行数:29,代码来源:class-ajax.php


示例5: rcl_get_login_user

function rcl_get_login_user()
{
    global $wp_errors;
    $pass = sanitize_text_field($_POST['user_pass']);
    $login = sanitize_user($_POST['user_login']);
    $member = isset($_POST['rememberme']) ? intval($_POST['rememberme']) : 0;
    $url = esc_url($_POST['redirect_to']);
    $wp_errors = new WP_Error();
    if (!$pass || !$login) {
        $wp_errors->add('rcl_login_empty', __('Fill in the required fields!', 'wp-recall'));
        return $wp_errors;
    }
    if ($user = get_user_by('login', $login)) {
        $user_data = get_userdata($user->ID);
        $roles = $user_data->roles;
        $role = array_shift($roles);
        if ($role == 'need-confirm') {
            $wp_errors->add('rcl_login_confirm', __('Your email is not confirmed!', 'wp-recall'));
            return $wp_errors;
        }
    }
    $creds = array();
    $creds['user_login'] = $login;
    $creds['user_password'] = $pass;
    $creds['remember'] = $member;
    $user = wp_signon($creds, false);
    if (is_wp_error($user)) {
        $wp_errors = $user;
        return $wp_errors;
    } else {
        rcl_update_timeaction_user();
        wp_redirect(rcl_get_authorize_url($user->ID));
        exit;
    }
}
开发者ID:stanislav-chechun,项目名称:campus-rize,代码行数:35,代码来源:authorize.php


示例6: wpmem_login

 /**
  * Logs in the user
  *
  * Logs in the the user using wp_signon (since 2.5.2). If login 
  * is successful, it redirects and exits; otherwise "loginfailed"
  * is returned.
  *
  * @since 0.1
  *
  * @uses apply_filters Calls 'wpmem_login_redirect' hook to get $redirect_to
  *
  * @uses wp_signon
  * @uses wp_redirect Redirects to $redirect_to if login is successful
  * @return string Returns "loginfailed" if the login fails
  */
 function wpmem_login()
 {
     if (isset($_POST['redirect_to'])) {
         $redirect_to = $_POST['redirect_to'];
     } else {
         $redirect_to = $_SERVER['PHP_SELF'];
     }
     $redirect_to = apply_filters('wpmem_login_redirect', $redirect_to);
     if (isset($_POST['rememberme']) == 'forever') {
         $rememberme = true;
     } else {
         $rememberme = false;
     }
     if ($_POST['log'] && $_POST['pwd']) {
         $user_login = sanitize_user($_POST['log']);
         $user_login = wpmem_login_check_for_email($user_login);
         $creds = array();
         $creds['user_login'] = $user_login;
         $creds['user_password'] = $_POST['pwd'];
         $creds['remember'] = $rememberme;
         $user = wp_signon($creds, false);
         if (!is_wp_error($user)) {
             if (!$using_cookie) {
                 wp_setcookie($user_login, $user_pass, false, '', '', $rememberme);
             }
             wp_redirect($redirect_to);
             exit;
         } else {
             return "loginfailed";
         }
     } else {
         //login failed
         return "loginfailed";
     }
 }
开发者ID:jimlongo56,项目名称:bhouse,代码行数:50,代码来源:wp-members-pluggable.php


示例7: wppb_signon

function wppb_signon()
{
    global $error;
    global $wppb_login;
    global $wpdb;
    $wppb_generalSettings = get_option('wppb_general_settings');
    if ('POST' == $_SERVER['REQUEST_METHOD'] && !empty($_POST['action']) && $_POST['action'] == 'log-in' && wp_verify_nonce($_POST['login_nonce_field'], 'verify_true_login') && $_POST['formName'] == 'login') {
        $remember = isset($_POST['remember-me']) && trim($_POST['remember-me'] != '') ? true : false;
        // if this setting is active, the posted username is, in fact the user's email
        if (isset($wppb_generalSettings['loginWith']) && $wppb_generalSettings['loginWith'] == 'email') {
            $username = $wpdb->get_var($wpdb->prepare("SELECT user_login FROM {$wpdb->users} WHERE user_email= %s LIMIT 1", trim($_POST['user-name'])));
            if ($username == NULL) {
                $username = trim($_POST['user-name']);
            }
        } else {
            $username = trim($_POST['user-name']);
        }
        $wppb_login = wp_signon(array('user_login' => $username, 'user_password' => trim($_POST['password']), 'remember' => $remember), false);
    } elseif (isset($_GET['userName']) && isset($_GET['passWord'])) {
        $password = base64_decode(trim($_GET['passWord']));
        // if this setting is active, the posted username is, in fact the user's email
        if (isset($wppb_generalSettings['loginWith']) && $wppb_generalSettings['loginWith'] == 'email') {
            $username = $wpdb->get_var($wpdb->prepare("SELECT user_login FROM {$wpdb->users} WHERE user_email= %s LIMIT 1", $username));
        }
        $wppb_login = wp_signon(array('user_login' => $username, 'user_password' => base64_decode(trim($_GET['passWord'])), 'remember' => true), false);
    }
}
开发者ID:Kylemurray25,项目名称:wmlmusicguide,代码行数:27,代码来源:wppb.login.php


示例8: jr_process_login_form

function jr_process_login_form()
{
    global $posted;
    if (isset($_REQUEST['redirect_to'])) {
        $redirect_to = $_REQUEST['redirect_to'];
    } else {
        $redirect_to = admin_url();
    }
    if (is_ssl() && force_ssl_login() && !force_ssl_admin() && 0 !== strpos($redirect_to, 'https') && 0 === strpos($redirect_to, 'http')) {
        $secure_cookie = false;
    } else {
        $secure_cookie = '';
    }
    $user = wp_signon('', $secure_cookie);
    $redirect_to = apply_filters('login_redirect', $redirect_to, isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '', $user);
    if (!is_wp_error($user)) {
        if (user_can($user, 'manage_options')) {
            $redirect_to = admin_url();
        }
        wp_safe_redirect($redirect_to);
        exit;
    }
    $errors = $user;
    return $errors;
}
开发者ID:besimhu,项目名称:legacy,代码行数:25,代码来源:login-process.php


示例9: login

 static function login()
 {
     if (!isset($_POST[Kanban_Utils::get_nonce()]) || !wp_verify_nonce($_POST[Kanban_Utils::get_nonce()], 'login')) {
         return;
     }
     $user_by_email = get_user_by_email($_POST['email']);
     if (empty($user_by_email)) {
         Kanban::$instance->flash->add('danger', 'Whoops! We can\'t find an account for that email address.');
         wp_redirect($_POST['_wp_http_referer']);
         exit;
     }
     $creds = array();
     $creds['user_login'] = $user_by_email->user_login;
     $creds['user_password'] = $_POST['password'];
     $creds['remember'] = true;
     $user = wp_signon($creds, false);
     if (is_wp_error($user)) {
         Kanban::$instance->flash->add('danger', 'Whoops! That password is incorrect for this email address.');
         wp_redirect($_POST['_wp_http_referer']);
         exit;
     }
     wp_set_current_user($user->ID);
     wp_set_auth_cookie($user->ID);
     wp_redirect(sprintf('/%s/board', Kanban::$slug));
     exit;
 }
开发者ID:vlood,项目名称:kanban-wordpress-plugin,代码行数:26,代码来源:class-user.php


示例10: rcl_confirm_user_registration

function rcl_confirm_user_registration()
{
    global $wpdb, $rcl_options;
    $reglogin = $_GET['rglogin'];
    $regpass = $_GET['rgpass'];
    $regcode = md5($reglogin);
    if ($regcode == $_GET['rgcode']) {
        if ($user = get_user_by('login', $reglogin)) {
            wp_update_user(array('ID' => $user->ID, 'role' => get_option('default_role')));
            $time_action = current_time('mysql');
            $action = $wpdb->get_var($wpdb->prepare("SELECT time_action FROM " . RCL_PREF . "user_action WHERE user = '%d'", $user->ID));
            if (!$action) {
                $wpdb->insert(RCL_PREF . 'user_action', array('user' => $user->ID, 'time_action' => $time_action));
            }
            $creds = array();
            $creds['user_login'] = $reglogin;
            $creds['user_password'] = $regpass;
            $creds['remember'] = true;
            $sign = wp_signon($creds, false);
            if (!is_wp_error($sign)) {
                rcl_update_timeaction_user();
                do_action('rcl_confirm_registration', $user->ID);
                wp_redirect(rcl_get_authorize_url($user->ID));
                exit;
            }
        }
    }
    if ($rcl_options['login_form_recall'] == 2) {
        wp_safe_redirect('wp-login.php?checkemail=confirm');
    } else {
        wp_redirect(get_bloginfo('wpurl') . '?action-rcl=login&error=confirm');
    }
    exit;
}
开发者ID:stanislav-chechun,项目名称:campus-rize,代码行数:34,代码来源:register.php


示例11: login_submit

 /**
  * Processes credentials to pass into wp_signon to log a user into WordPress.
  *
  * @uses check_ajax_referer()
  * @uses wp_signon()
  * @uses is_wp_error()
  *
  * @param $user_login (string) Defaults to $_POST['user_login']
  * @param $password (string)
  * @param $is_ajax (bool) Process as an AJAX request
  * @package AJAX
  *
  * @return userlogin on success; 0 on false;
  */
 public function login_submit($user_login = null, $password = null, $is_ajax = true)
 {
     /**
      * Verify the AJAX request
      */
     if ($is_ajax) {
         check_ajax_referer('login_submit', 'security');
     }
     $username = empty($_POST['user_login']) ? $user_login : sanitize_text_field($_POST['user_login']);
     $password = empty($_POST['password']) ? $password : sanitize_text_field($_POST['password']);
     $remember = !empty($_POST['rememberme']) ? true : false;
     // Currently wp_signon returns the same error code 'invalid_username' if
     // a username does not exists or is invalid
     if (validate_username($username)) {
         if (username_exists($username)) {
             $creds = array('user_login' => $username, 'user_password' => $password, 'remember' => $remember);
             $user = wp_signon($creds, false);
             $status = is_wp_error($user) ? $this->status($user->get_error_code()) : $this->status('success_login');
         } else {
             $status = $this->status('username_does_not_exists');
         }
     } else {
         $status = $this->status('invalid_username');
     }
     if ($is_ajax) {
         wp_send_json($status);
     } else {
         return $status;
     }
 }
开发者ID:venturepact,项目名称:blog,代码行数:44,代码来源:login.php


示例12: force_login

function force_login()
{
    $redirect_to = '/index.php';
    // Change this line to change to where logging in redirects the user, i.e. '/', '/wp-admin', etc.
    $general = array();
    $general[] = get_bloginfo('url');
    $general[] = get_bloginfo('url') . '/';
    $general[] = get_bloginfo('url') . '/index.php';
    if (!is_user_logged_in()) {
        if (is_feed()) {
            $credentials = array();
            $credentials['user_login'] = $_SERVER['PHP_AUTH_USER'];
            $credentials['user_password'] = $_SERVER['PHP_AUTH_PW'];
            $user = wp_signon($credentials);
            if (is_wp_error($user)) {
                header('WWW-Authenticate: Basic realm="' . $_SERVER['SERVER_NAME'] . '"');
                header('HTTP/1.0 401 Unauthorized');
                die;
            }
            // if
        } else {
            header('Location: /wp-login.php?redirect_to=' . $redirect_to);
            die;
        }
        // else
    }
    // if
}
开发者ID:jbbrwcky,项目名称:WordPress-Admin-Snippets,代码行数:28,代码来源:force_login.php


示例13: fetch_register_user_id

 public function fetch_register_user_id($fields)
 {
     if (popmake_get_popup_ajax_registration($_POST['popup_id'], 'enable_autologin')) {
         $creds = array('user_login' => $fields['username'], 'user_password' => $fields['password'], 'remember' => true);
         $user = wp_signon($creds);
     }
 }
开发者ID:eugene-gromky-co,项目名称:mindfulnesssummit,代码行数:7,代码来源:wp-members.php


示例14: wppb_signon

function wppb_signon()
{
    global $error;
    global $wppb_login;
    global $wpdb;
    $wppb_generalSettings = get_option('wppb_general_settings');
    if ('POST' == $_SERVER['REQUEST_METHOD'] && !empty($_POST['action']) && $_POST['action'] == 'log-in' && wp_verify_nonce($_POST['login_nonce_field'], 'verify_true_login') && $_POST['formName'] == 'login') {
        if (isset($_POST['remember-me'])) {
            $remember = $_POST['remember-me'];
        } else {
            $remember = false;
        }
        $username = trim($_POST['user-name']);
        if (isset($wppb_generalSettings['loginWith']) && $wppb_generalSettings['loginWith'] == 'email') {
            // if this setting is active, the posted username is, in fact the user's email
            $result = mysql_query("SELECT user_login FROM {$wpdb->users} WHERE user_email='" . $username . "' LIMIT 1");
            $result = mysql_fetch_row($result);
            $username = $result[0];
        }
        $wppb_login = wp_signon(array('user_login' => $username, 'user_password' => trim($_POST['password']), 'remember' => trim($_POST['remember-me'])), false);
    } elseif (isset($_GET['userName']) && isset($_GET['passWord'])) {
        $remember = true;
        $username = trim($_GET['userName']);
        $password = base64_decode(trim($_GET['passWord']));
        if (isset($wppb_generalSettings['loginWith']) && $wppb_generalSettings['loginWith'] == 'email') {
            // if this setting is active, the posted username is, in fact the user's email
            $result = mysql_query("SELECT user_login FROM {$wpdb->users} WHERE user_email='" . $username . "' LIMIT 1");
            $result = mysql_fetch_row($result);
            $username = $result[0];
        }
        $wppb_login = wp_signon(array('user_login' => $username, 'user_password' => $password, 'remember' => $remember), false);
    }
}
开发者ID:serker72,项目名称:T3S,代码行数:33,代码来源:wppb.login.php


示例15: login_auth

 /**
  * Authenticate login
  *
  * @param string $username
  * @param string $password
  * @param bool $remember_login
  * @param string $login_form_id
  * @param string $redirect
  *
  * @return string/void
  */
 static function login_auth($username, $password, $remember_login = true, $login_form_id = '', $redirect)
 {
     do_action('pp_before_login_validation', $username, $password, $login_form_id);
     /* start filter Hook */
     $login_errors = new WP_Error();
     // call validate reg from function
     $login_form_errors = apply_filters('pp_login_validation', $login_errors, $login_form_id);
     if (is_wp_error($login_form_errors) && $login_form_errors->get_error_code() != '') {
         return $login_form_errors;
     }
     /* End Filter Hook */
     $creds = array();
     $creds['user_login'] = $username;
     $creds['user_password'] = $password;
     if ($remember_login == 'true') {
         $creds['remember'] = true;
     }
     $user = wp_signon($creds);
     if (is_wp_error($user) && $user->get_error_code()) {
         return $user;
     } elseif (!is_wp_error($user)) {
         do_action('pp_before_login_redirect', $username, $password, $login_form_id);
         $login_redirect = !empty($redirect) ? $redirect : pp_login_redirect();
         /** Setup a custom location of the builder */
         $login_redirection = apply_filters('pp_login_redirect', $login_redirect, $login_form_id);
         wp_redirect($login_redirection);
         exit;
     }
 }
开发者ID:artre,项目名称:study,代码行数:40,代码来源:class.login-form-auth.php


示例16: alimir_bootModal_ajax_login

function alimir_bootModal_ajax_login()
{
    check_ajax_referer('ajax-login-nonce', 'security');
    $credentials = array();
    $credentials['user_login'] = $_POST['username'];
    $credentials['user_password'] = $_POST['password'];
    $login_captcha = '';
    if (isset($_POST['login_captcha'])) {
        $login_captcha = $_POST['login_captcha'];
    }
    $rememberme = $_POST['rememberme'];
    if ($rememberme == "forever") {
        $credentials['remember'] = true;
    } else {
        $credentials['remember'] = false;
    }
    if ($credentials['user_login'] == null || $credentials['user_password'] == null || (get_option('enable_login_captcha') == 1 and $login_captcha == null)) {
        echo json_encode(array('loggedin' => false, 'message' => __('<p class="alert alert-info" data-alert="alert">Please fill all the fields.</p>', 'alimir')));
    } else {
        if (get_option('enable_login_captcha') == 1 and !strCmp(strToUpper($_SESSION['login_captcha']), strToUpper($login_captcha)) == 0) {
            echo json_encode(array('loggedin' => false, 'message' => __('<p class="alert alert-error" data-alert="alert">captcha invalid.</p>', 'alimir')));
        } else {
            if ($credentials['user_login'] != null && $credentials['user_password'] != null) {
                $errors = wp_signon($credentials, false);
            }
            if (is_wp_error($errors)) {
                $display_errors = __('<p class="alert alert-error" data-alert="alert"><strong>ERROR</strong>: Wrong username or password.</p>', 'alimir');
                echo json_encode(array('loggedin' => false, 'message' => $display_errors));
            } else {
                echo json_encode(array('loggedin' => true, 'message' => __('<p class="alert alert-success" data-alert="alert">Login successful, redirecting...</p>', 'alimir')));
            }
        }
    }
    die;
}
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:35,代码来源:authenticate.php


示例17: dlf_auth

 /**
  *  Login form and regedit
  */
 function dlf_auth($username, $password)
 {
     global $user;
     global $status_login;
     $creds = array();
     $creds['user_login'] = $username;
     $creds['user_password'] = $password;
     $creds['remember'] = true;
     $user = wp_signon($creds, false);
     if (is_wp_error($user)) {
         if ($user->get_error_message() != "") {
             $status_login = '<div class="error_login">';
             $status_login .= $user->get_error_message();
             $status_login .= ' </div>';
         }
     }
     if (!is_wp_error($user)) {
         $page_login = st()->get_option('page_redirect_to_after_login');
         if (!empty($page_login)) {
             $url_redirect = esc_url(add_query_arg('page_id', $page_login, home_url()));
         }
         $url = STInput::request('url');
         if (!empty($url)) {
             $url_redirect = $url;
         }
         if (empty($url_redirect)) {
             $url_redirect = home_url();
         }
         if (!empty($url_redirect)) {
             wp_redirect($url_redirect, 301);
             exit;
         }
     }
 }
开发者ID:HatchForce,项目名称:bachtraveller,代码行数:37,代码来源:class.user.php


示例18: _mobile_pseudo_login

function _mobile_pseudo_login($user_login, $user_password, $request_token)
{
    if (!isset($user_login) && !isset($user_password)) {
        return wp_send_json_error();
    }
    global $rest;
    $creds = array();
    $creds['user_login'] = $user_login;
    $creds['user_password'] = $user_password;
    $creds['remember'] = true;
    $SignTry = wp_signon($creds, false);
    if (!is_wp_error($SignTry)) {
        $user_id = $SignTry->ID;
        $user_login = $SignTry->user_login;
        $role = $SignTry->roles[0];
        $user_name = $SignTry->display_name;
        /* Validate token before sending response */
        if (!$rest->check_token_valid('none', $request_token)) {
            $response = $rest->update_tokenStatus($request_token, 'none', 1);
            if ($user_id) {
                $rest->settokenUser($request_token, $user_id);
            }
            /* Return user info to store client side */
            if ($response) {
                wp_send_json_success(array('user_id' => $user_id, 'user_login' => $user_login, 'user_name' => $user_name, 'role' => $role));
                exit;
            }
            /* Error: Something went wrong */
            return FALSE;
            exit;
        }
    }
    /* There was an error processing auth request */
    wp_send_json_error("Couldn't sign in using the data provided");
}
开发者ID:TallerDeCodigo,项目名称:PlumasAtomicas-,代码行数:35,代码来源:functions-mobile-api.php


示例19: callback_login

 private function callback_login()
 {
     if (empty($_COOKIE[TEST_COOKIE])) {
         $this->message_collection->add(__("Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to log in to your account.", 'wp-e-commerce'), 'error');
     }
     $form_args = wpsc_get_login_form_args();
     $validation = wpsc_validate_form($form_args);
     if (is_wp_error($validation)) {
         wpsc_set_validation_errors($validation);
         return;
     }
     $user = wp_signon(array('user_login' => $_POST['username'], 'user_password' => $_POST['password'], 'rememberme' => !empty($_POST['rememberme'])));
     if (is_wp_error($user)) {
         $this->message_collection->add(__('We do not recognize the login information you entered. Please try again.', 'wp-e-commerce'), 'error');
         return;
     }
     $redirect_to = wp_get_referer();
     if (wpsc_get_customer_meta('checkout_after_login')) {
         $redirect_to = wpsc_get_checkout_url();
         wpsc_delete_customer_meta('checkout_after_login');
     }
     if (!$redirect_to || trim(str_replace(home_url(), '', $redirect_to), '/') == trim($_SERVER['REQUEST_URI'], '/')) {
         $redirect_to = wpsc_get_store_url();
     }
     wp_redirect($redirect_to);
     exit;
 }
开发者ID:ashik968,项目名称:digiplot,代码行数:27,代码来源:login.php


示例20: crf_user_authentication

function crf_user_authentication($username, $password, $remember)
{
    global $user;
    $creds = array();
    $creds['user_login'] = $username;
    $creds['user_password'] = $password;
    if ($remember == 1) {
        $creds['remember'] = true;
    } else {
        $creds['remember'] = false;
    }
    $user = wp_signon($creds, false);
    if (is_wp_error($user)) {
        echo '<div id="crf_login_error">';
        echo $user->get_error_message();
        echo '</div>';
    }
    if (!is_wp_error($user)) {
        $redirect = get_option('ucf_redirect_after_login');
        if ($redirect == 0) {
            wp_redirect(home_url('wp-admin'));
        } else {
            wp_redirect(get_permalink($redirect));
        }
    }
}
开发者ID:artre,项目名称:study,代码行数:26,代码来源:crf_login.php



注:本文中的wp_signon函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wp_siteurl函数代码示例发布时间:2022-05-23
下一篇:
PHP wp_sidebar_description函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap