- This topic has 5 replies, 3 voices, and was last updated 9 years, 5 months ago by .
Viewing 6 posts - 1 through 6 (of 6 total)
Viewing 6 posts - 1 through 6 (of 6 total)
- You must be logged in to reply to this topic.
WordPress Membership Plugin
Simple Membership Plugin › Forums › Simple Membership Plugin › Add login/password field to header (instead of side widget)
Tagged: header, login form
Hi, Thanks for the fantastic product!
1) Is it possible to add the login form to the header? I want the actual username/password inputs instead of making the user go to a separate login page. I am not using a side widget and would like it on all pages.
2) If user is already logged in, I’d like to display the username and a logout link. I think the code is something like:
<?php
if ( SwpmMemberUtils::is_member_logged_in() ) {
$mp_username = SwpmMemberUtils::get_logged_in_members_user_name();
echo(‘<div class=”user_menu user_menu_registered”>’ . $mp_username . ‘</div> Logout‘);
}
else {
echo ‘LOGIN FORM GOES HERE’;
}
?>
Can you please help me? Thanks again!
Hi, have you checked the following URL Miscellaneous Tweaks?
Thanks, yes. That’s how I was able to write the php to determine if the user is logged in or not. However, I am still unable to find documentation of how to print the login form itself. This part:
else {
echo ‘LOGIN FORM GOES HERE’;
}
In the widget, it’s:
[swpm_login_form]
This does not work in header.php. Any ideas? Thanks for the help.
Hi, the plugin developers will investigate further your issue.
Thank you
You can use the following code to add the login form in any of your theme’s PHP file:
<?php
echo do_shortcode('[swpm_login_form]');
?>
In your case, you will add it to the header.php
That’s exactly what I needed! Works perfectly. Thanks for the great product and support!