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


PHP _fill_user函数代码示例

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


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

示例1: get_user_by_email

 /**
  * Retrieve user info by email.
  *
  * @since 2.5
  *
  * @param string $email User's email address
  * @return bool|object False on failure, User DB row object
  */
 function get_user_by_email($email)
 {
     global $wpdb;
     $user_id = wp_cache_get($email, 'useremail');
     $user = false;
     if (false !== $user_id) {
         $user = wp_cache_get($user_id, 'users');
     }
     if (false !== $user) {
         return $user;
     }
     if (!($user = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->users} WHERE user_email = %s", $email)))) {
         return false;
     }
     _fill_user($user);
     return $user;
 }
开发者ID:nurpax,项目名称:saastafi,代码行数:25,代码来源:pluggable.php

示例2: get_user_by

 /**
  * Retrieve user info by a given field
  *
  * @since 2.8.0
  *
  * @param string $field The field to retrieve the user with.  id | slug | email | login
  * @param int|string $value A value for $field.  A user ID, slug, email address, or login name.
  * @return bool|object False on failure, User DB row object
  */
 function get_user_by($field, $value)
 {
     global $wpdb;
     switch ($field) {
         case 'id':
             return get_userdata($value);
             break;
         case 'slug':
             $user_id = wp_cache_get($value, 'userslugs');
             $field = 'user_nicename';
             break;
         case 'email':
             $user_id = wp_cache_get($value, 'useremail');
             $field = 'user_email';
             break;
         case 'login':
             $value = sanitize_user($value);
             $user_id = wp_cache_get($value, 'userlogins');
             $field = 'user_login';
             break;
         default:
             return false;
     }
     if (false !== $user_id) {
         return get_userdata($user_id);
     }
     if (!($user = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->users} WHERE {$field} = %s", $value)))) {
         return false;
     }
     _fill_user($user);
     return $user;
 }
开发者ID:alicam,项目名称:wordpress,代码行数:41,代码来源:pluggable.php

示例3: wp_get_userdata

 function wp_get_userdata($user_id)
 {
     global $wpdb, $wp_version;
     //added wp_version
     if (function_exists('absint')) {
         // new WordPress
         $user_id = absint($user_id);
     } else {
         // old WordPress
         $user_id = (int) $user_id;
     }
     if ($user_id == 0) {
         return false;
     }
     $user = wp_cache_get($user_id, 'users');
     if ($user) {
         return $user;
     }
     if ((double) $wp_version >= 2.3) {
         // newer versions do more sql escaping
         if (!($user = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->users} WHERE ID = %d LIMIT 1", $user_id)))) {
             return false;
         }
     } else {
         if (!($user = $wpdb->get_row("SELECT * FROM {$wpdb->users} WHERE ID = '{$user_id}' LIMIT 1"))) {
             return false;
         }
     }
     if ((double) $wp_version >= 2.5) {
         // function simplified for newer WP
         _fill_user($user);
     } else {
         // old branches
         $wpdb->hide_errors();
         $metavalues = $wpdb->get_results("SELECT meta_key, meta_value FROM {$wpdb->usermeta} WHERE user_id = '{$user_id}'");
         $wpdb->show_errors();
         if ($metavalues) {
             foreach ($metavalues as $meta) {
                 if ((double) $wp_version < 2.2) {
                     @($value = unserialize($meta->meta_value));
                     if ($value === FALSE) {
                         $value = $meta->meta_value;
                     }
                 } else {
                     //WP 2.2+ branch
                     $value = maybe_unserialize($meta->meta_value);
                 }
                 $user->{$meta->meta_key} = $value;
                 // We need to set user_level from meta, not row
                 if ($wpdb->prefix . 'user_level' == $meta->meta_key) {
                     $user->user_level = $meta->meta_value;
                 }
             }
             // end foreach
         }
         //end if
         // For backwards compat.
         if (isset($user->first_name)) {
             $user->user_firstname = $user->first_name;
         }
         if (isset($user->last_name)) {
             $user->user_lastname = $user->last_name;
         }
         if (isset($user->description)) {
             $user->user_description = $user->description;
         }
         wp_cache_add($user_id, $user, 'users');
         if ((double) $wp_version < 2.2) {
             wp_cache_add($user->user_login, $user, 'userlogins');
         } else {
             //WP 2.2 version
             wp_cache_add($user->user_login, $user_id, 'userlogins');
         }
     }
     return $user;
 }
开发者ID:Oddsor,项目名称:lpt-forum,代码行数:76,代码来源:wp-functions.php

示例4: _mkuser

function _mkuser($user_data)
{
    if (!is_array($user_data)) {
        return false;
    }
    _fill_user($user_data);
    $user_object = object;
    foreach ($user_data as $field => $value) {
        $user_object->{$field} = $value;
    }
    return $user_object;
}
开发者ID:HaThuy92,项目名称:hathithuy_quanlytinchi,代码行数:12,代码来源:user.php

示例5: auth_redirect

<?php

require 'cm-load.php';
auth_redirect();
$new_user_data = $_POST;
$user_new_pass = $new_user_data['newpass'];
$user_new_pass_retype = $new_user_data['newpass_retype'];
$user_current_password = $new_user_data['password'];
_fill_user($new_user_data);
unset($new_user_data['password']);
if (cm_check_password($user_current_password)) {
    if (!empty($user_new_pass)) {
        if ($user_new_pass == $user_new_pass_retype) {
            $new_user_data['password'] = md5($user_new_pass);
        } else {
            $message = "Mật khẩu mới ở hai ô phải giống nhau";
        }
    }
    $cmdb->update($cmdb->users, $new_user_data, array("ID" => get_user_id(), "type" => "student"));
    $message = "Thông tin của bạn đã được thay đổi thành công";
} else {
    $message = "Mật khẩu hiện tại không đúng";
}
cm_redirect(site_url() . "/?cm=profile&action=edit&message=" . urlencode($message));
开发者ID:HaThuy92,项目名称:hathithuy_quanlytinchi,代码行数:24,代码来源:profile-update.php


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