目前使用者
<?php global $current_user;
get_currentuserinfo();
echo '使用者名: ' . $current_user->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";
?>
登入使用者
- <?php
- global $current_user, $display_name , $user_email;
- get_currentuserinfo();
- //全局變量$current_user
- echo 'Username: ' . $current_user->user_login . "\n";
- echo 'User email: ' . $current_user->user_email . "\n";
- echo 'User first name: ' . $current_user->user_firstname . "\n";
- echo 'User last name: ' . $current_user->user_lastname . "\n";
- echo 'User display name: ' . $current_user->display_name . "\n";
- echo 'User ID: ' . $current_user->ID . "\n";
- //單獨的全局變量
- echo $display_name . "'s email address is: " . $user_email;
- ?>