Tips and Tricks HQ Support Portal › Forums › WP eMember › WP eMember F.A.Q/Instructions › How to Retrieve and Show Specific Details of the Logged-in Member
Tagged: display member info, edit form, emember api, member data, members
- This topic has 20 replies, 9 voices, and was last updated 10 years ago by orjanmen.
-
AuthorPosts
-
May 10, 2012 at 12:21 am #6293adminKeymaster
Using Shortcode
You can display particular information of the logged in member using the “wp_eMember_user_details” shortcode.
The following example will show you how to display the logged in 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"]
More examples
The following will show the username:
[wp_eMember_user_details user_info="user_name"]
The following will show the firstname:
[wp_eMember_user_details user_info="first_name"]
The following will show the lastname:
[wp_eMember_user_details user_info="last_name"]
The following will show the membership level name of this member:
[wp_eMember_user_details user_info="user_membership_level_name"]
The following will show the additional membership level name(s) of this member:
[wp_eMember_user_details user_info="user_additional_membership_level_names"]
The following will show the expiry date:
[wp_eMember_user_details user_info="member_expiry_date"]
Using PHP
Use the following function to retrieve particular field value of the logged in user:
wp_eMember_get_user_details($field_name)
Below is an example that will retrieve the username of the logged-in member:
$field_name = 'user_name';
$value = wp_eMember_get_user_details($field_name);
echo 'Your username is: ' . $value ;Here is another example that will retrieve the email address of the logged-in member:
$field_name = 'email';
$value = wp_eMember_get_user_details($field_name);
echo 'Your 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 the 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,profile_picture_src,
member_expiry_date.
Showing the Details of a Particular User
Check the following post:
May 10, 2012 at 12:34 am #44939adminKeymasterAccessing Custom Fields of the Member
If you had a custom field named “School” then you could use the following shortcode to show the value of this field:
[wp_eMember_user_details user_info="School"]
If you had a custom field named “Student ID” then you would use the following to show the value of this field (the space character needs to be replaced with “_”):
[wp_eMember_user_details user_info="Student_ID"]
May 28, 2013 at 2:18 am #44940adminKeymasterAccessing Custom Fields of a Member Using PHP
If you had a custom field named “School” then you could use the following PHP code to show the value of this field:
<?php
$emember_auth = Emember_Auth::getInstance();
$value = $emember_auth->getUserInfo('School');
echo "Field Value: ".$value ;
?>If you had a custom field named “Student ID” then you would use the following to show the value of this field (the space character needs to be replaced with “_”):
<?php
$emember_auth = Emember_Auth::getInstance();
$value = $emember_auth->getUserInfo('Student_ID');
echo "Field Value: ".$value ;
?>June 24, 2013 at 9:54 am #44941silvio.boscoloMemberHello Admin, PHP script seems to work only with standard fields.
I have a custom field named “Ruolo” but I’m not able to get his value :
[http://www.travel-advisor.it/prove]
Can you help me, please?
Silvio
June 25, 2013 at 12:34 am #44942adminKeymasterPlease tell me what code you used on that page to retrieve the value of a user’s field. Also, are you viewing the page while logged into the site as a member? What version of eMember are you using?
July 5, 2013 at 9:48 pm #44943BjeddMemberI have 2 custom fields that I want to grab and pass out to an external query. Could I use the above to do something like this?
function get_url($request_url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $request_url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}and then a request :
$request_url = 'https://mysite.com//Default.aspx?js=[customfield-info1 here]&pe=[customfieldinfo-2 here]';
$response = get_url($request_url);Honestly, I’m not a PHP programmer. I researched a bit and this was the closest I could find to a solution.
July 6, 2013 at 1:40 am #44944adminKeymasterYes, you should be able to pass values to the “Default.aspx” script using the method you explained above.
July 8, 2013 at 5:33 am #44945iDesignPassionMemberI would like to retrieve and show a custom field input of a certain member
[http://thedreamteammovement.com/lps/lp642653/?id=test]
for example his id is test – and I have a custom field – AR code – and I want to display that.. regardless of them signed in or not…
I need this custom field to show for the specified /?id=?? for anyone to see the page
thanks
July 8, 2013 at 7:14 am #44946adminKeymasterWhat you suggested will require some custom coding (the option explained on this post won’t do the job). You will need to develop a script/plugin that takes the username/ID from the URL query parameter and then makes a database query to retrieve the details of that user.
We have a member profile display addon that maybe close to what you want (you can hack/tweak it maybe):
http://www.tipsandtricks-hq.com/wordpress-membership/wp-emember-profile-display-extended-addon-599
February 10, 2014 at 7:01 pm #44947tysonbrooksMemberWhat about if you want to get the information for a specific user, who is NOT logged in? How can you go about doing that?
February 10, 2014 at 11:30 pm #44948adminKeymasterCheck the URL under the “Showing the Details of a Particular User” section above and you will get your answer.
May 3, 2014 at 10:58 pm #44949McpMember@iDesignPassion, If you read me one day.
Have you hack or tweak the addon, or find another solution to do what you want? i’m interested about that.
Thank you.
May 3, 2014 at 11:20 pm #44950wzpModerator@iDesignPassion was last seen 9 months ago…
May 3, 2014 at 11:26 pm #44951McpMemberI know,
i just putted a message in a bottle just in case….
But if in 9 month you have a more precise answer, i’m ready to read it!
May 4, 2014 at 12:41 am #44952wzpModeratorWhat he wanted to do was access information of a member that wasn’t necessarily logged in. This subject has been covered in other threads:
For the last thread, if you want to use PHP instead of the shortcodes, have a look at the wp_eMember_user_details_handler() function definition inside the eMember_misc_functions.php file. This function parses the shortcodes.
-
AuthorPosts
- You must be logged in to reply to this topic.