【开发笔记】获取当前用户及blog的session

用户信息
根据wp-include/user.php 里的函数setup_userdata 的说明(解释),用户的信息都储存在这些变量中(使用时用global)

* @global string $userdata User description.
$userdata储存用户描述;
 * @global string $user_login The user username for logging in
$user_login用户名
 * @global int $user_level The level of the user 
用户级别
 * @global int $user_ID The ID of the user
用户ID
 * @global string $user_email The email address of the user
用户邮箱信息
 * @global string $user_url The url in the user’s profile
用户的URL地址
 * @global string $user_pass_md5 MD5 of the user’s password
$user_pass_md5 MD5加密后的用户密码
 * @global string $user_identity The display name of the user
 *用户显示名称

$current_blog 变量储存当前使用(子)博客的信息,该变量为一个SQL查询 wp表前缀_blogs 所获取到的结果集,如需要博客ID,则使用 $current_blog->blog_id。

此条目发表在 wordpress 分类目录。将固定链接加入收藏夹。

【开发笔记】获取当前用户及blog的session》有 3 条评论

  1. 去耳畔 说:

    我来了,我来支持你了

  2. CrazyLemon 说:

    我也找不到北。。。

  3. 小敏 说:

    水哥的博客专业性很强,我都迷路了。

发表评论

电子邮件地址不会被公开。 必填项已被标记为 *

*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>