当前位置: 首页>>代码示例>>PHP>>正文


PHP get_userdatabylogin函数代码示例

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


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

示例1: wp_check_bind_user

function wp_check_bind_user($username, $password)
{
    if (empty($password)) {
        return __('<strong>ERROR</strong>: The password field is empty.');
    }
    $userdata = get_userdatabylogin($username);
    if (!$userdata) {
        return sprintf(__('<strong>ERROR</strong>: Invalid username. <a href="%s" title="Password Lost and Found">Lost your password</a>?'), site_url('wp-login.php?action=lostpassword', 'login'));
    }
    if (is_multisite()) {
        // Is user marked as spam?
        if (1 == $userdata->spam) {
            return __('<strong>ERROR</strong>: Your account has been marked as a spammer.');
        }
        // Is a user's blog marked as spam?
        if (!is_super_admin($userdata->ID) && isset($userdata->primary_blog)) {
            $details = get_blog_details($userdata->primary_blog);
            if (is_object($details) && $details->spam == 1) {
                return __('Site Suspended.');
            }
        }
    }
    $userdata = apply_filters('wp_authenticate_user', $userdata, $password);
    if (is_wp_error($userdata)) {
        return;
    }
    if (!wp_check_password($password, $userdata->user_pass, $userdata->ID)) {
        return sprintf(__('<strong>ERROR</strong>: The password you entered for the username <strong>%1$s</strong> is incorrect. <a href="%2$s" title="Password Lost and Found">Lost your password</a>?'), $username, site_url('wp-login.php?action=lostpassword', 'login'));
    }
}
开发者ID:liangwei1988,项目名称:wordpress,代码行数:30,代码来源:signup.php

示例2: username_exists

/**
 * Checks whether the given username exists.
 *
 * @since 2.0.0
 *
 * @param string $username Username.
 * @return null|int The user's ID on success, and null on failure.
 */
function username_exists( $username ) {
	if ( $user = get_userdatabylogin( $username ) ) {
		return $user->ID;
	} else {
		return null;
	}
}
开发者ID:realfluid,项目名称:umbaugh,代码行数:15,代码来源:registration.php

示例3: msum_maybe_add_roles

function msum_maybe_add_roles($user_login)
{
    $userdata = get_userdatabylogin($user_login);
    if ($userdata != false && get_user_meta($userdata->ID, 'msum_has_caps', true) != 'true') {
        msum_add_roles($userdata->ID);
    }
}
开发者ID:howardlei82,项目名称:IGSM-Website,代码行数:7,代码来源:ms-user-management.php

示例4: php_exec_process

function php_exec_process($phpexec_text)
{
    $phpexec_userdata = get_userdatabylogin(the_author('login', false));
    if ($phpexec_userdata->user_level >= php_exec_getuserlevel()) {
        $phpexec_doeval = true;
    }
    $phpexec_textarr = preg_split("/(<phpcode>.*<\\/phpcode>)/Us", $phpexec_text, -1, PREG_SPLIT_DELIM_CAPTURE);
    // capture the tags as well as in between
    $phpexec_stop = count($phpexec_textarr);
    // loop stuff
    for ($phpexec_i = 0; $phpexec_i < $phpexec_stop; $phpexec_i++) {
        $phpexec_content = $phpexec_textarr[$phpexec_i];
        if (preg_match("/^<phpcode>(.*)<\\/phpcode>/Us", $phpexec_content, $phpexec_code)) {
            // If it's a phpcode
            $phpexec_php = $phpexec_code[1];
            if ($phpexec_doeval) {
                ob_start();
                eval("?>" . $phpexec_php . "<?php ");
                $phpexec_output .= ob_get_clean();
            } else {
                $phpexec_output .= htmlspecialchars($phpexec_php);
            }
        } else {
            $phpexec_output .= $phpexec_content;
        }
    }
    return $phpexec_output;
}
开发者ID:rajankz,项目名称:webspace,代码行数:28,代码来源:phpexec.php

示例5: wp_authenticate_username_password

function wp_authenticate_username_password($user, $username, $password)
{
    if (is_a($user, 'WP_User')) {
        return $user;
    }
    if (empty($username) || empty($password)) {
        $error = new WP_Error();
        if (empty($username)) {
            $error->add('empty_username', __('<strong>ERROR</strong>: The username field is empty.'));
        }
        if (empty($password)) {
            $error->add('empty_password', __('<strong>ERROR</strong>: The password field is empty.'));
        }
        return $error;
    }
    $userdata = get_userdatabylogin($username);
    if (!$userdata || $userdata->user_login != $username) {
        return new WP_Error('invalid_username', __('<strong>ERROR</strong>: Invalid username.'));
    }
    $userdata = apply_filters('wp_authenticate_user', $userdata, $password);
    if (is_wp_error($userdata)) {
        return $userdata;
    }
    if (!wp_check_password($password, $userdata->user_pass, $userdata->ID)) {
        return new WP_Error('incorrect_password', __('<strong>ERROR</strong>: Incorrect password.'));
    }
    $user = new WP_User($userdata->ID);
    return $user;
}
开发者ID:schr,项目名称:wordpress,代码行数:29,代码来源:user.php

示例6: widget_author_info_card

function widget_author_info_card($args)
{
    if (get_query_var('author_name')) {
        $curauth = get_userdatabylogin(get_query_var('author_name'));
    } else {
        $curauth = get_userdata(get_query_var('author'));
    }
    extract($args);
    echo $before_widget . $before_title;
    // If its the author page.
    if (get_option('sa_add_to_author_page') == 'yes' && is_author()) {
        $title = $curauth->display_name;
        echo $title . $after_title;
        echo sa_author_info_card($curauth);
    } else {
        $title = "List of Authors";
        echo $title . $after_title;
        ob_start();
        wp_list_authors('show_fullname=1&optioncount=1');
        $author_list = ob_get_contents();
        ob_end_clean();
        echo "<ul>{$author_list}</ul>";
    }
    echo $after_widget;
}
开发者ID:ranveerkunal,项目名称:showauthor,代码行数:25,代码来源:showauthor.php

示例7: retrieve_password

/**
 * Handles sending password retrieval email to user.
 *
 * @uses $wpdb WordPress Database object
 *
 * @return bool|WP_Error True: when finish. WP_Error on error
 */
function retrieve_password()
{
    global $wpdb;
    $errors = new WP_Error();
    if (empty($_POST['user_login']) && empty($_POST['user_email'])) {
        $errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or e-mail address.'));
    }
    if (strpos($_POST['user_login'], '@')) {
        $user_data = get_user_by_email(trim($_POST['user_login']));
        if (empty($user_data)) {
            $errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.'));
        }
    } else {
        $login = trim($_POST['user_login']);
        $user_data = get_userdatabylogin($login);
    }
    do_action('lostpassword_post');
    if ($errors->get_error_code()) {
        return $errors;
    }
    if (!$user_data) {
        $errors->add('invalidcombo', __('<strong>ERROR</strong>: Invalid username or e-mail.'));
        return $errors;
    }
    // redefining user_login ensures we return the right case in the email
    $user_login = $user_data->user_login;
    $user_email = $user_data->user_email;
    do_action('retreive_password', $user_login);
    // Misspelled and deprecated
    do_action('retrieve_password', $user_login);
    $allow = apply_filters('allow_password_reset', true, $user_data->ID);
    if (!$allow) {
        return new WP_Error('no_password_reset', __('Password reset is not allowed for this user'));
    } else {
        if (is_wp_error($allow)) {
            return $allow;
        }
    }
    $user_email = $_POST['user_email'];
    $user_login = $_POST['user_login'];
    $user = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->users} WHERE user_login = %s", $user_login));
    if (empty($user)) {
        return new WP_Error('invalid_key', __('Invalid key'));
    }
    $new_pass = wp_generate_password(12, false);
    do_action('password_reset', $user, $new_pass);
    wp_set_password($new_pass, $user->ID);
    update_usermeta($user->ID, 'default_password_nag', true);
    //Set up the Password change nag.
    $message = sprintf(__('Username: %s'), $user->user_login) . "\r\n";
    $message .= sprintf(__('Password: %s'), $new_pass) . "\r\n";
    $message .= site_url() . '/?ptype=affiliate' . "\r\n";
    $title = sprintf(__('[%s] Your new password'), get_option('blogname'));
    $title = apply_filters('password_reset_title', $title);
    $message = apply_filters('password_reset_message', $message, $new_pass);
    if ($message && !wp_mail($user_email, $title, $message)) {
        die('<p>' . __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function...') . '</p>');
    }
    return true;
}
开发者ID:annguyenit,项目名称:getdeal,代码行数:67,代码来源:affiliate_login.php

示例8: get_currentuserinfo

function get_currentuserinfo()
{
    // a bit like get_userdata(), on steroids
    global $user_login, $userdata, $user_level, $user_ID, $user_nickname, $user_email, $user_url, $user_pass_md5, $cookiehash, $xoopsUser;
    // *** retrieving user's data from cookies and db - no spoofing
    /*
    	$user_login = $_COOKIE['wordpressuser_'.$cookiehash];
    	$userdata = get_userdatabylogin($user_login);
    	$user_level = $userdata->user_level;
    	$user_ID = $userdata->ID;
    	$user_nickname = $userdata->user_nickname;
    	$user_email = $userdata->user_email;
    	$user_url = $userdata->user_url;
    	$user_pass_md5 = md5($userdata->user_pass);
    */
    if ($xoopsUser) {
        $user_login = $xoopsUser->uname();
        $userdata = get_userdatabylogin($user_login);
        $user_level = $userdata->user_level;
        $user_ID = $userdata->ID;
        $user_nickname = $userdata->user_nickname;
        $user_email = $userdata->user_email;
        $user_url = $userdata->user_url;
        //		$user_pass_md5 = md5($userdata->user_pass);
        $user_pass_md5 = $xoopsUser->pass();
    }
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:27,代码来源:functions.php

示例9: comber_login_guest

function comber_login_guest()
{
    if (isset($_POST['comber_user_login']) && wp_verify_nonce($_POST['comber_login_nonce'], 'comber-login-nonce')) {
        // this returns the user ID and other info from the user name
        $user = get_userdatabylogin($_POST['comber_user_login']);
        if (!$user) {
            // if the user name doesn't exist
            comber_errors()->add('empty_username', __('Invalid username'));
        }
        if (!isset($_POST['comber_user_pass']) || $_POST['comber_user_pass'] == '') {
            // if no password was entered
            comber_errors()->add('empty_password', __('Please enter a password'));
        }
        // check the user's login with their password
        if (!wp_check_password($_POST['comber_user_pass'], $user->user_pass, $user->ID)) {
            // if the password is incorrect for the specified user
            comber_errors()->add('empty_password', __('Incorrect password'));
        }
        // retrieve all error messages
        $errors = comber_errors()->get_error_messages();
        // only log the user in if there are no errors
        if (empty($errors)) {
            wp_setcookie($_POST['comber_user_login'], $_POST['comber_user_pass'], true);
            wp_set_current_user($user->ID, $_POST['comber_user_login']);
            do_action('wp_login', $_POST['comber_user_login']);
            wp_redirect(home_url($_POST['current_page']));
            exit;
        } else {
            wp_redirect(home_url($_POST['current_page'] . '/?login=true&fail=true'));
            exit;
        }
    }
}
开发者ID:SaloCreative,项目名称:thecomberwedding.co.uk,代码行数:33,代码来源:process.php

示例10: wp_authenticate_username_password

function wp_authenticate_username_password($user, $username, $password)
{
    if (is_a($user, 'WP_User')) {
        return $user;
    }
    if (empty($username) || empty($password)) {
        $error = new WP_Error();
        if (empty($username)) {
            $error->add('empty_username', __('<strong>ERROR</strong>: The username field is empty.'));
        }
        if (empty($password)) {
            $error->add('empty_password', __('<strong>ERROR</strong>: The password field is empty.'));
        }
        return $error;
    }
    $userdata = get_userdatabylogin($username);
    if (!$userdata) {
        return new WP_Error('invalid_username', sprintf(__('<strong>ERROR</strong>: Invalid username. <a href="%s" title="Password Lost and Found">Lost your password</a>?'), site_url('wp-login.php?action=lostpassword', 'login')));
    }
    $userdata = apply_filters('wp_authenticate_user', $userdata, $password);
    if (is_wp_error($userdata)) {
        return $userdata;
    }
    if (!wp_check_password($password, $userdata->user_pass, $userdata->ID)) {
        return new WP_Error('incorrect_password', sprintf(__('<strong>ERROR</strong>: Incorrect password. <a href="%s" title="Password Lost and Found">Lost your password</a>?'), site_url('wp-login.php?action=lostpassword', 'login')));
    }
    $user = new WP_User($userdata->ID);
    return $user;
}
开发者ID:jao,项目名称:jpcamargo,代码行数:29,代码来源:user.php

示例11: hm_parse_user

/**
 * hm_parse_user function.
 *
 * @access public
 * @param mixed $user. (default: null)
 * @return void
 */
function hm_parse_user($user = null)
{
    // We're we passed an object with ID
    if (is_object($user) && is_numeric($user->ID)) {
        return get_userdata($user->ID);
    }
    // We're we passed an object with user_id
    if (is_object($user) && is_numeric($user->user_id)) {
        return get_userdata($user->user_id);
    }
    // We're we passed an array
    if (is_array($user) && is_numeric($user['ID'])) {
        return get_userdata($user['ID']);
    }
    // ID
    if (is_numeric($user)) {
        return get_userdata($user);
    }
    // username
    if (is_string($user)) {
        return get_userdatabylogin($user);
    }
    // null
    global $current_user;
    return get_userdata($current_user->ID);
}
开发者ID:newsapps,项目名称:hm-core,代码行数:33,代码来源:hm-core.functions.php

示例12: retrieve_password

/**
 * Handles sending password retrieval email to user.
 *
 * @uses $wpdb WordPress Database object
 *
 * @return bool|WP_Error True: when finish. WP_Error on error
 */
function retrieve_password()
{
    global $wpdb;
    $errors = new WP_Error();
    if (empty($_POST['user_login']) && empty($_POST['user_email'])) {
        $errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or e-mail address.', 'templatic'));
    }
    if (strpos($_POST['user_login'], '@')) {
        $user_data = get_user_by_email(trim($_POST['user_login']));
        if (empty($user_data)) {
            $errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.', 'templatic'));
        }
    } else {
        $login = trim($_POST['user_login']);
        $user_data = get_userdatabylogin($login);
    }
    do_action('lostpassword_post');
    if ($errors->get_error_code()) {
        return $errors;
    }
    if (!$user_data) {
        $errors->add('invalidcombo', __('<strong>ERROR</strong>: Invalid username or e-mail.', 'templatic'));
        return $errors;
    }
    // redefining user_login ensures we return the right case in the email
    $user_login = $user_data->user_login;
    $user_email = $user_data->user_email;
    do_action('retreive_password', $user_login);
    // Misspelled and deprecated
    do_action('retrieve_password', $user_login);
    $user_email = $_POST['user_email'];
    $user_login = $_POST['user_login'];
    $user = $wpdb->get_row("SELECT * FROM {$wpdb->users} WHERE user_login like \"{$user_login}\" or user_email like \"{$user_login}\"");
    if (empty($user)) {
        return new WP_Error('invalid_key', __('Invalid key', 'templatic'));
    }
    $new_pass = wp_generate_password(12, false);
    do_action('password_reset', $user, $new_pass);
    wp_set_password($new_pass, $user->ID);
    update_usermeta($user->ID, 'default_password_nag', true);
    //Set up the Password change nag.
    $message = '<p><b>Your login Information :</b></p>';
    $message .= '<p>' . sprintf(__('Username: %s', 'templatic'), $user->user_login) . "</p>";
    $message .= '<p>' . sprintf(__('Password: %s', 'templatic'), $new_pass) . "</p>";
    $message .= '<p>You can login to : <a href="' . site_url() . '/?ptype=login' . "\">Login</a> or the URL is :  " . site_url() . "/?ptype=login</p>";
    $message .= '<p>Thank You,<br> ' . get_option('blogname') . '</p>';
    $user_email = $user_data->user_email;
    $user_name = $user_data->user_nicename;
    $fromEmail = get_site_emailId();
    $fromEmailName = get_site_emailName();
    $title = sprintf(__('[%s] Your new password', 'templatic'), get_option('blogname'));
    $title = apply_filters('password_reset_title', $title);
    $message = apply_filters('password_reset_message', $message, $new_pass);
    if (get_option('pttthemes_send_mail') == 'Enable' || get_option('pttthemes_send_mail') == '') {
        templ_sendEmail($fromEmail, $fromEmailName, $user_email, $user_name, $title, $message, $extra = '');
        ///forgot password email
    }
    return true;
}
开发者ID:annguyenit,项目名称:getdeal,代码行数:66,代码来源:registration.php

示例13: username_exists

function username_exists( $username ) {
	global $wpdb;
	$username = sanitize_user( $username );
	$user = get_userdatabylogin($username);
	if ( $user )
		return $user->ID;

	return null;
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:9,代码来源:registration-functions.php

示例14: user_pass_ok

function user_pass_ok($user_login,$user_pass) {
	global $cache_userdata;
	if ( empty($cache_userdata[$user_login]) ) {
		$userdata = get_userdatabylogin($user_login);
	} else {
		$userdata = $cache_userdata[$user_login];
	}
	return (md5($user_pass) == $userdata->user_pass);
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:9,代码来源:user.php

示例15: synlogin

 function synlogin($get, $post)
 {
     !API_SYNLOGIN && exit(API_RETURN_FORBIDDEN);
     $user = get_userdatabylogin($get['username']);
     if ($user) {
         header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');
         wp_set_auth_cookie($user->ID, false, '');
     }
     exit(API_RETURN_SUCCEED);
 }
开发者ID:heartshare,项目名称:ucenter-integration,代码行数:10,代码来源:uc.php


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