WordPress: Function Reference/get userdata:修订间差异
(新页面: == Description == Returns an object with the information pertaining to the user whose ID is passed to it. Properties map directly to wp_users table in the database (see [[WordPress:Datab...) |
无编辑摘要 |
||
第1行: | 第1行: | ||
== Description == | == Description == | ||
== 描述 == | |||
Returns an object with the information pertaining to the user whose ID is passed to it. Properties map directly to wp_users table in the database (see [[WordPress:Database Description#Table:_wp_users|Database Description]]). | Returns an object with the information pertaining to the user whose ID is passed to it. Properties map directly to wp_users table in the database (see [[WordPress:Database Description#Table:_wp_users|Database Description]]). | ||
返回object,带有关于ID传递到这个object的用户的信息。属性可能直接映射到数据库中的wp_users表格(请看看[[WordPress:Database Description#Table:_wp_users|数据库描述]])。 | |||
== Usage == | == Usage == | ||
== 用法== | |||
%%% <?php get_userdata(userid); ?> %%% | %%% <?php get_userdata(userid); ?> %%% | ||
%%% <?php get_userdata(userid); ?> %%% | |||
== Examples == | == Examples == | ||
=== Default Usage === | === Default Usage === | ||
== 例子 == | |||
===默认用法=== | |||
The call to <tt>get_userdata()</tt> returns the user's data, where it can be retrieved using member variables. | The call to <tt>get_userdata()</tt> returns the user's data, where it can be retrieved using member variables. | ||
调用<tt>get_userdata()</tt>返回用户的数据,可以使用member变数,重新得到这个数据。 | |||
<?php $user_info = get_userdata(1); | <?php $user_info = get_userdata(1); | ||
第23行: | 第35行: | ||
User level: 10<br /> | User level: 10<br /> | ||
User ID: 1</div> | User ID: 1</div> | ||
<?php $user_info = get_userdata(1); | |||
echo('Username: ' . $user_info->user_login . '\n'); | |||
echo('User level: ' . $user_info->user_level . '\n'); | |||
echo('User ID: ' . $user_info->ID . '\n'); | |||
?> | |||
<div style="border:1px solid blue; width:50%; padding:10px">用户名: 管理<br /> | |||
用户级别: 10<br /> | |||
用户 ID: 1</div> | |||
=== Accessing Usermeta Data === | === Accessing Usermeta Data === | ||
===访问 Usermeta 数据=== | |||
<?php $user_info = get_userdata(1); | <?php $user_info = get_userdata(1); | ||
echo($user_info->last_name . ", " . $user_info->first_name . "\n"); | |||
?> | |||
<div style="border:1px solid blue; width:50%; padding:10px"> | |||
Blow, Joe<br /> | |||
</div> | |||
<?php $user_info = get_userdata(1); | |||
echo($user_info->last_name . ", " . $user_info->first_name . "\n"); | echo($user_info->last_name . ", " . $user_info->first_name . "\n"); | ||
第35行: | 第75行: | ||
== Parameters == | == Parameters == | ||
== 参数== | |||
{{Parameter|$userid|integer|The ID of the user whose data should be retrieved.}} | {{Parameter|$userid|integer|The ID of the user whose data should be retrieved.}} | ||
{{Parameter|$userid|integer|应该返回数据的用户的ID。}} | |||
== Values in users & user_meta table == | == Values in users & user_meta table == | ||
== 用户& user_meta 表格中的参数值 == | |||
Here are the values in the users table you can access via this function: | Here are the values in the users table you can access via this function: | ||
你可以通过这个函数,使用用户表格中的这些参数值: | |||
=== users === | === users === | ||
=== 用户 === | |||
:ID<br /> | |||
:user_login<br /> | |||
:user_pass<br /> | |||
:user_nicename<br /> | |||
:user_email<br /> | |||
:user_url<br /> | |||
:user_registered<br /> | |||
:user_activation_key<br /> | |||
:user_status<br /> | |||
:display_name<br /> | |||
=== useful in user_meta === | |||
:first_name<br /> | |||
:last_name<br /> | |||
:nickname<br /> | |||
:user_level<br /> | |||
:ID<br /> | :ID<br /> | ||
:user_login<br /> | :user_login<br /> | ||
第57行: | 第135行: | ||
== See Also == | == See Also == | ||
==也看看 == | |||
[[WordPress:Function_Reference/get_currentuserinfo]] | |||
[[WordPress:Function_Reference/get_currentuserinfo]] | [[WordPress:Function_Reference/get_currentuserinfo]] |
2008年7月19日 (六) 17:09的版本
Description
描述
Returns an object with the information pertaining to the user whose ID is passed to it. Properties map directly to wp_users table in the database (see Database Description).
返回object,带有关于ID传递到这个object的用户的信息。属性可能直接映射到数据库中的wp_users表格(请看看数据库描述)。
Usage
用法
%%% <?php get_userdata(userid); ?> %%% %%% <?php get_userdata(userid); ?> %%%
Examples
Default Usage
例子
默认用法
The call to get_userdata() returns the user's data, where it can be retrieved using member variables.
调用get_userdata()返回用户的数据,可以使用member变数,重新得到这个数据。
<?php $user_info = get_userdata(1); echo('Username: ' . $user_info->user_login . '\n'); echo('User level: ' . $user_info->user_level . '\n'); echo('User ID: ' . $user_info->ID . '\n'); ?>
User level: 10
<?php $user_info = get_userdata(1);
echo('Username: ' . $user_info->user_login . '\n'); echo('User level: ' . $user_info->user_level . '\n'); echo('User ID: ' . $user_info->ID . '\n'); ?>
用户级别: 10
Accessing Usermeta Data
访问 Usermeta 数据
<?php $user_info = get_userdata(1); echo($user_info->last_name . ", " . $user_info->first_name . "\n"); ?>
Blow, Joe
<?php $user_info = get_userdata(1);
echo($user_info->last_name . ", " . $user_info->first_name . "\n"); ?>
Blow, Joe
Parameters
参数
Values in users & user_meta table
用户& user_meta 表格中的参数值
Here are the values in the users table you can access via this function:
你可以通过这个函数,使用用户表格中的这些参数值:
users
用户
- ID
- user_login
- user_pass
- user_nicename
- user_email
- user_url
- user_registered
- user_activation_key
- user_status
- display_name
useful in user_meta
- first_name
- last_name
- nickname
- user_level
- ID
- user_login
- user_pass
- user_nicename
- user_email
- user_url
- user_registered
- user_activation_key
- user_status
- display_name
useful in user_meta
- first_name
- last_name
- nickname
- user_level
See Also
也看看
WordPress:Function_Reference/get_currentuserinfo WordPress:Function_Reference/get_currentuserinfo