WordPress create a user profile page for everyone

Multi tool use
WordPress create a user profile page for everyone
I am trying to make a user profile page for all WordPress user, so visitor can see each user's profile with their basic information.
user
is the native Author
not a custom post type
user
Author
for example: My custom user profile links
https://myexample.com/user/joe/
---- will show joe's profile
https://myexample.com/user/joe/
https://myexample.com/user/jhon/
---- will show jhon's profile
https://myexample.com/user/jhon/
but my code works for only admin/author is there any way to dispaly
<?php
$ID = the_author_meta('ID');
$first_name = the_author_meta('first_name');
$last_name = the_author_meta('last_name');
$user_fullname = $first_name . ' ' . $last_name;
$nickname = the_author_meta('nickname');
$branch_code = the_author_meta('branch_code');
$index_no = the_author_meta('index_no');
$sp_designation = the_author_meta('sp_designation');
$description = the_author_meta('description');
$mobile_number = the_author_meta('mobile_number');
$user_email = the_author_meta('user_email');
?>
can anyone help me to solve this ?
2 Answers
2
You can use get_user_meta function.
Something like this :
<?php echo get_user_meta($user_id, 'first_name', TRUE); ?>
https://developer.wordpress.org/reference/functions/get_user_meta/
user
Author
Check the updated answer
– BigBoss
Jul 1 at 6:01
what will be pass through
$user_id
– Firefog
Jul 1 at 6:33
$user_id
The user_id. You can use "get_current_user_id()" to get the current user id.
– BigBoss
Jul 1 at 6:41
get_current_user_id()
will show the current user who logged in . but I need the user slug which i currently visiting– Firefog
Jul 1 at 6:44
get_current_user_id()
I use bellow code to make a custom user profile page hope this help others
<?php
$curauth = ( get_query_var( 'author_name' ) ) ? get_user_by( 'slug', get_query_var( 'author_name' ) ) : get_userdata( get_query_var( 'author' ) );
$first_name = $curauth-> first_name;
$last_name = $curauth-> last_name;
$nickname = $curauth-> nickname;
$branch_code = $curauth-> branch_code;
$index_no = $curauth-> index_no;
$sp_designation = $curauth-> sp_designation;
$mobile_number = $curauth-> mobile_number;
$user_email = $curauth-> user_email;
$user_fullname = $first_name . ' ' . $last_name;
?>
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
no
user
is the nativeAuthor
not a custom post type– Firefog
Jul 1 at 5:38