简体   繁体   English

如何在登录wordpress的用户上显示wp_users和wp_usermeta的所有信息

[英]how can I display all info on wp_users and wp_usermeta on user logged in wordpress

how can I display all info on user when logged in, 登录后如何显示有关用户的所有信息,

like 喜欢

first name last Name email 名:姓:电子邮箱

custom field -address -telephone 自定义字段-地址-电话

I got here a line of code and I dont know what to do with it 我在这里得到了一行代码,但我不知道该怎么办

$all_meta_for_user = get_user_meta( userid );

function which can used is get_currentuserinfo to get current logged in user details. 可以使用的功能是get_currentuserinfo以获取当前登录的用户详细信息。

function used to custom fields of user is get_user_meta 用于自定义用户字段的函数是get_user_meta

<?php global $current_user;
      get_currentuserinfo();

      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";
?>

Once you get logged in user id , you can use get_user_meta to get details. 登录用户ID后,就可以使用get_user_meta来获取详细信息。

<?php
  $all_meta_for_user = get_user_meta($current_user->ID );
  print_r( $all_meta_for_user );
?>

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM