Tips and Tricks HQ Support Portal › Forums › WP eMember › WP eMember F.A.Q/Instructions › How to Retrieve and Show Details of a Specific Member
- This topic has 0 replies, 1 voice, and was last updated 10 years, 11 months ago by admin.
-
AuthorPosts
-
October 26, 2013 at 1:20 am #9904adminKeymaster
Using Shortcode
You can display particular information of a member using the “wp_eMember_user_details” shortcode.
The following example will show you how to display a particular member’s email. The “email” parameter can be changed to any other member details attribute to show that particular info:
[wp_eMember_user_details user_info="email" member_id="1"]
The “member_id” parameter value (example: 1) is the ID of the user that you want to show the info of.
More examples
Here are some example shortcodes that will show various info of the member whose ID is 1
The following will show the username:
[wp_eMember_user_details user_info="user_name" member_id="1"]
The following will show the firstname:
[wp_eMember_user_details user_info="first_name" member_id="1"]
The following will show the lastname:
[wp_eMember_user_details user_info="last_name" member_id="1"]
The following will show the account status:
[wp_eMember_user_details user_info="account_state" member_id="1"]
The following will show the expiry date:
[wp_eMember_user_details user_info="member_expiry_date" member_id="1"]
Retrieve Member Details Using PHP
Use the following function to retrieve field value of a particular member:
wp_emember_get_user_details_by_id($field_name, $member_id)
Below is an example that will retrieve the username of the member whose ID is 1:
$field_name = 'user_name';
$member_id = '1';
$value = wp_emember_get_user_details_by_id($field_name, $member_id);
echo 'Username is: ' . $value ;Here is another example that will retrieve the email address of the member whose ID is 1:
$field_name = 'email';
$member_id = '1';
$value = wp_emember_get_user_details_by_id($field_name, $member_id);
echo 'Email is: ' . $value ;Also, take a look at the following documentation which has many useful example codes:
http://www.tipsandtricks-hq.com/wordpress-membership/wp-emember-miscellaneous-tweaks-248
Available default field name attributes
Below is a list of available field name attributes (excluding custom fields) that you can use with this shortcode or PHP function:
user_name, first_name,last_name,email,phone, address_street, address_state, address_zipcode, address_city, member_since,membership_level,account_state,home_page,
country, gender,subscription_starts,company_name, user_membership_level_name,
user_additional_membership_level_names, profile_picture_src,
member_expiry_date.
Retrieving and Showing the Details of Currently Logged-In Member
Check the following post:
-
AuthorPosts
- The topic ‘How to Retrieve and Show Details of a Specific Member’ is closed to new replies.