wordpress 的内部用户变量
user_login . "\n";
echo '用户邮箱: ' . $current_user->user_email . "\n";
echo '名字: ' . $current_user->user_firstname . "\n";
echo '姓氏: ' . $current_user->user_lastname . "\n";
echo '公开显示名: ' . $current_user->display_name . "\n";
echo '用户 ID:' . $current_user->ID . "\n";
?>
自己为wordpress写个新cookie给第三方程序使用
在模板的functions.php增加一个函数
//add new cookie
function set_newuser_cookie() {
global $current_user;
get_currentuserinfo();
$username = $current_user->user_login;
$nicename = $current_user->user_nicename;
if (!isset($_COOKIE['java_cookie'])) {
setcookie('j_username', $username, time()+1209600, COOKIEPATH, COOKIE_DOMAIN, false);
setcookie('j_nicename', $nicename, time()+1209600, COOKIEPATH, COOKIE_DOMAIN, false);
}
}
在模板的functions.php增加一句话
add_action('after_setup_theme', 'set_newuser_cookie');