- This topic has 2 replies, 2 voices, and was last updated 14 years, 4 months ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 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 Tweaks › For those wanting the widget to reflect if a member is logged in…
Hi all,
I’ve been working with this plugin for about a week now, and I think it’s great. Of course, there is always room for improvement, and I thought one option that would be nice is to have the login widget reflect if a user is logged in or not.
i.e., if a user is logged in, the widget will be “Welcome jeffw!” As opposed to still retaining the “Member Login.” This method makes more sense, especially since after you login, the widget turns into a mini control panel.
Here’s the code:
function show_wp_eMember_login_widget($args){
global $config;
extract($args);
global $current_user;
get_currentuserinfo();
$widget_title = $config->getValue(‘wp_eMember_widget_title’);
if ( is_user_logged_in() ) {
$widget_title = ‘Welcome ‘ . $current_user->user_login . ‘!’;
} else if(empty($widget_title)) $widget_title = EMEMBER_MEMBER_LOGIN;
echo $before_widget;
echo $before_title . $widget_title . $after_title;
echo eMember_login_widget();
echo $after_widget;
}
You need to copypaste that code into the wp_eMember1.php file, at the exact function, which is the function show_wp_eMember_login_widget, around line 386.
Keep in mind, I am using this program with the create identical WP user, and this will only work with that, since it is calling the user_login of the wp user, unless this works some other way.
Enjoy!
– Jeff W
Thanks for the code Jeff. The widget should automatically display the logged in member’s name and a few other details. Wasn’t this happening for you?
Yes. The membername would be displayed along with the account expiration, etc, once logged in.
Sorry, I wasn’t exactly clear… That code changes the widget title to be “Welcome (username)!” once logged in, as opposed to keeping the “Member Login” widget title.