latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

How to add Log in link to header.

Home Forums Community Forum How to add Log in link to header.

Tagged: 

This topic contains 6 replies, has 3 voices. Last updated by  Bruce 3 years, 11 months ago.

Topic Author Topic
Posted: Monday Jan 14th, 2013 at 10:17 am #37376

List Of Topic Replies

Viewing 6 replies - 1 through 6 (of 6 total)
Author Replies
Author Replies
Posted: Monday Jan 14th, 2013 at 10:24 am #37379
Staff Member

Thanks for your inquiry. ~ We appreciate your patience :-)

The login widget you see at the top of s2Member.com was constructed using the s2Member Pro Login Widget function in PHP, and then styled to match our site. Please see this article in the s2Member Codex for further details about the s2member_pro_login_widget() function. It can be integrated into a custom theme if you like.

Posted: Monday Jan 14th, 2013 at 3:18 pm #37518

You rock. I’ll start there!!!

Thanks, Jason!!

Posted: Saturday Jan 26th, 2013 at 6:23 am #39673

Hi Jason,

I need a bit of help with this one. I’m trying to work my way through coding and php and having some trouble if you could point me in the right direction, please?

To be clear, to add the log in/register links to the header, I need to add some code to my child theme functions file. I’ve come up with this but getting errors:

01. if (!function_exists (“s2member_pro_login_widget”))
02. {
03. function s2member_pro_login_widget ($options = FALSE, $args = FALSE)
04. $options => array
05. array(“signup_url” => __(%%automatic%%),
06. “login_redirect” => __(“”),
07. “logout_redirect” => “%%home%%”,
08. {
09. $args = (is_array ($args)) ? $args : array (“before_widget” => “”, “before_title” => “

“, “after_title” => “

“, “after_widget” => “”);
10. /**/
11. return eval (‘ob_start(); c_ws_plugin__s2member_pro_login_widget::widget($args, $options); $ob = ob_get_clean(); return $ob;’);
12. }
13. }
14. ?>

I would really like to do this myself but I’m afraid I will destroy my site without a bit of help. Could you please give me the basic rundown of the steps I need to take to achieve my goal?

Posted: Saturday Jan 26th, 2013 at 7:02 am #39676

and add this to my header.php file….

Posted: Saturday Jan 26th, 2013 at 7:03 am #39677
< ?php

if ( is_user_logged_in() ) {
echo 'Logout’;
} else {
echo ‘Login‘;
}

?>
Posted: Tuesday Jan 29th, 2013 at 1:53 am #39840
Bruce
Username: Bruce
Staff Member

Thank-you for your inquiry.

To be clear, to add the log in/register links to the header, I need to add some code to my child theme functions file. I’ve come up with this but getting errors:

01. if (!function_exists (“s2member_pro_login_widget”))
02. {
03. function s2member_pro_login_widget ($options = FALSE, $args = FALSE)
04. $options => array
05. array(“signup_url” => __(%%automatic%%),
06. “login_redirect” => __(“”),
07. “logout_redirect” => “%%home%%”,
08. {
09. $args = (is_array ($args)) ? $args : array (“before_widget” => “”, “before_title” => “
“, “after_title” => “

“, “after_widget” => “”);
10. /**/
11. return eval (‘ob_start(); c_ws_plugin__s2member_pro_login_widget::widget($args, $options); $ob = ob_get_clean(); return $ob;’);
12. }
13. }
14. ?>

All of this code should not be needed. Instead, you should just call the function directly, like this:

<?php echo s2member_pro_login_widget(); ?>

The info provided in Jason’s link shows what arguments you can pass to this function. For instance, if you’d like to change the title when not logged in, you would do the following:

<?php
$args = array('title' => 'My New Title');

echo s2member_pro_login_widget($args);
?>

That is about as far as we can go with custom code. Please see s2Member® » Support Policy » Within Scope. If you need any further assistance with setting this up, we recommend posting a job listing on http://jobs.wordpress.net/ or http://elance.com/.

Viewing 6 replies - 1 through 6 (of 6 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.