The latest release of s2Member Pro comes with documentation on how to achieve this with the Pro Login Widget for s2Member. Please check your WordPress Dashboard under:
s2Member -> API Scripting -> Login Widget via PHP.
Basically, you just do this:
- Code: Select all
<?php echo s2member_pro_login_widget(); ?>
( Optional ) there are MANY configurable options.
- Code: Select all
This function allows for the inclusion of the Pro Login Widget directly into a theme/plugin file.
This API function will return the HTML output from the widget function call.
Example usage: <?php echo s2member_pro_login_widget($options, $args); ?>
The $options parameter (array) is completely optional ( i.e. NOT required ).
It can be passed in as an array of options; overriding some or all of these defaults:
"title" => "Membership Login" ——— Title when NOT logged in, or leave this blank if you'd prefer not to show a title.
"signup_url" => "%%automatic%%" ——— Full Signup URL, or use %%automatic%% for the Membership Options Page. If you leave this blank, it will not be shown.
"login_redirect" => "" ——— Empty ( i.e. "" ) = Login Welcome Page, %%previous%% = Previous Page, %%home%% = Home Page, or use a full URL of your own.
"logged_out_code" => "" ——— HTML/PHP code to display when logged out. May also contain WP Shortcodes if you like.
"profile_title" => "My Profile Summary" ——— Title when a User is logged in. Or you can leave this blank if you'd prefer not to show a title.
"display_gravatar" => "1" ——— Display Gravatar image when logged in? 1 = yes, 0 = no. Gravatars are based on email address.
"link_gravatar" => "1" ——— Link Gravatar image to Gravatar.com? 1 = yes, 0 = no. Allows Users to setup a Gravatar.
"display_name" => "1" ——— Display the current User's WordPress® `Display Name` when logged in? 1 = yes, 0 = no.
"logged_in_code" => "" ——— HTML/PHP code to display when logged in. May also contain WP Shortcodes if you like.
"logout_redirect" => "%%home%%" ——— Empty ( i.e. "" ) = Login Screen, %%previous%% = Previous Page, %%home%% = Home Page, or use a full URL of your own.
"my_account_url" => "%%automatic%%" ——— Full URL of your own, or use %%automatic%% for the Login Welcome Page. Leave empty to not show this at all.
"my_profile_url" => "%%automatic%%" ——— Full URL of your own, or use %%automatic%% for a JavaScript popup. Leave empty to not show this at all.
The $args parameter (array) is also completely optional ( i.e. NOT required ).
It can be passed in as an array of options: overriding some or all of these defaults:
"before_widget" => "" ——— HTML code to display before the widget.
"before_title" => "<h3>" ——— HTML code to display before the title.
"after_title" => "</h3>" ——— HTML code to display after the title.
"after_widget" => "" ——— HTML code to display after the widget.