- This topic has 8 replies, 6 voices, and was last updated 10 years, 4 months ago by .
Viewing 9 posts - 1 through 9 (of 9 total)
Viewing 9 posts - 1 through 9 (of 9 total)
- You must be logged in to reply to this topic.
Support site for Tips and Tricks HQ premium products
by
Tips and Tricks HQ Support Portal › Forums › WP eMember › WP eMember F.A.Q/Instructions › How to get member id and his details (retrieve member details)
Tagged: member details, member id, retrieve member details
Hi,
Is there a way, first to check whether user is logged in or not.. If yes than his member id?
Do we have any shortcode OR php code for this?
Update: You can now use the method explained here to access and show any details of the logged-in member:
Here is an example code that lets you find out if a member is logged in and what his membership ID and level is:
global $auth;
$user_id = $auth->getUserInfo('member_id');
if (!empty($user_id))
{
//User is logged in so add your conditional code here
$membership_level = $auth->getUserInfo('membership_level');
if($membership_level == 1)
{
//Add stuff for this level
}
}
There are more examples here:
http://www.tipsandtricks-hq.com/wordpress-membership/wp-emember-miscellaneous-tweaks-248
This is how you can get the name of a logged in user:
global $auth;
$user_id = $auth->getUserInfo('member_id');
if (!empty($user_id))
{
//User is logged in so you can display the name
$first_name = $auth->getUserInfo('first_name');
$last_name = $auth->getUserInfo('last_name');
echo "Hello ".$first_name." ".$last_name;
}
woops! posted in the wrong one.
edited
Is there a shortcode to display name and membership level
I have install a member dashboard and I would like to have their name and memberhsip level display on the page.
Thanks
You can use the following shortcodes to display the first and last name
[wp_eMember_first_name]
[wp_eMember_last_name]
There is no shortcode for membership level. This page have some example codes of how to retrieve the membership level which might help:
http://www.tipsandtricks-hq.com/wordpress-membership/wp-emember-miscellaneous-tweaks-248
Thanks
Its not working on theme header.php file? I need to set other menu instead of default menu after login, so i need to know is_member_logged_in ?
How can i know is_member_logged_in on theme header.php file
The correct function name is the following:
wp_emember_is_member_logged_in()
Are you using that?