Support Forum

Change Login / Register button links

MM Michael Montague
Michael Montague
Member

Hi, I’m looking to integrate the UserPro membership plugin into my site. I will be using the reboot theme. I want to use the UserPro login/registration forms rather than the SP ones. How can I change the hyperlink for these buttons? I dug around a bit but couldn’t find the code.

I’m also contemplating removing these buttons and just using the login/register buttons on another part of my site, since SP should sync everything up fine with wordpress’ user membership too correct? How can I remove both these buttons from the header in that case?

Thanks! 

14 Answers

New Answer

MP Mr Papa
Mr Papa
Member

see these for how to replace the urls to yours:

https://simple-press.com/documentation/codex/api/template-functions-and-the-api/display-template-functions/common-view/sp_loginoutbutton/

https://simple-press.com/documentation/codex/api/template-functions-and-the-api/display-template-functions/common-view/sp_registerbutton/

to remove, just remove those template function calls from your sp theme… they are in the spHead.php template file…  as always, before editing a theme, we suggest making a child theme or creating your own theme…

MM Michael Montague
Michael Montague
Member

Excellent, thanks for the fast response!!

MM Michael Montague
Michael Montague
Member

I’ve removed the login/register buttons by commenting out the code in spHeadDesktop.php (in a child theme). When I view the site on my iPhone there is the Actions drop down box for Log In, Register and Search. I can’t find where to remove this code… 

Thanks!

YS Yellow Swordfish
Yellow Swordfish
Member

As you would have found the spHeadDesktop.php file in the ‘desktop’ folder of the theme so there is an spHeadMobile.php in an equivalent ‘mobile’ folder. You just need to give it the same treatment.

MM Michael Montague
Michael Montague
Member

Thanks, I had done that actually, cache must not have been clearing properly, tried another browser and it was refreshed. Cheers!

MM Michael Montague
Michael Montague
Member

Hi, I decided to add the login URL back into my site button, but I can’t get it to display correctly using the API. I’m a bit confused about the quote characters and the argument options, do they need to be nested? If someone could clarify would be great!

With this code the forum doesn’t load in the page:

sp_LogInOutButton(‘tagClass=spButton spRight’,’logInLink’=’http://panorev.com/profile/login’,’logOutLink’=’http://panorev.com/profile/logout’, __sp(‘Log In’), __sp(‘Log Out’), __sp(‘Log in and log out’)); 

With this code, it loads, but the button displays the text logOutLink’=’http://panorev.com/profile/logout as seen in this pic: 

 

sp_LogInOutButton(‘tagClass=spButton spRight’,’logInLink=http://panorev.com/profile/login’,’logOutLink=http://panorev.com/profile/logout’, __sp(‘Log In’), __sp(‘Log Out’), __sp(‘Log in and log out’));

It would be clearer if you provided an example on the Codex. Thanks 

YS Yellow Swordfish
Yellow Swordfish
Member

There IS an example in the codex just here. However – I do see that this particular example only passes one argument.

The method that ALL Simple:Press display functions use to pass arguments is the same as the method that WordPress uses. That is that all the function arguments are sent as one, long string of text using name=value pairs with each pair separated by an ampersand.

So – using your own code from above that would be sent as:

sp_LogInOutButton('tagClass=spButton spRight&logInLink=http://panorev.com/profile/login&logOutLink=http://panorev.com/profile/logout', __sp('Log In'), __sp('Log Out'), __sp('Log in and log out'));

Hope that helps.

MM Michael Montague
Michael Montague
Member

Thanks mate that makes total sense now. I didn’t realise they were passed in like normal php elements in a URL, so maybe an example with multiple args is useful, but maybe this question isn’t asked very much. Great support from you guys 🙂 

YS Yellow Swordfish
Yellow Swordfish
Member

Thank you and happy to have helped. I hope this means it worked as expected 🙂

MM Michael Montague
Michael Montague
Member

Thanks it works on the desktop, but not in spHeadMobile.php using the Reboot with a child theme. My code for this is below but it sends me to a page http://panorev.com/forum/logInLink instead:

sp_LogInOutButton('tagClass=spControl&mobileMenu=1&logInLink=http://panorev.com/login&logOutLink=http://panorev.com/logout', __sp('Log In'), __sp('Log Out'));
MM Michael Montague
Michael Montague
Member

Think I just fixed that now too.

I’ve just set the mobileMenu flag to 0 and it’s working, even though the menu still displays in a drop down box which is fine. I thought setting that arg to 0 would disable the dropdown menu. 

IK Ike
Ike
Member

Strange, although it’s still technically inside ‘sp_MobileMenuStart’ section so it will remain in the drop down, I’m not sure why having it enabled would use the argument ‘logInLink‘ in the URL unless there was a typo in the function arguments.

Either way, glad it’s working how it should!