Support Forum

Simple:Press Login Component Not Working

JL Jessica Lopez
Jessica Lopez
Member

Our Simple:Press login component is not working: 

https://museumstoreassociation.org/shoptalk/

When a user clicks the Simple:Press “Login” button, the page expands to show the login box for “Login name” and “Password”.

When the user submits their account information, they are routed the My Account page, which is our site’s login page, but they have not been logged in. They then need to re-enter their credentials to proceed. 

I’m guessing that the issue is occurring because we are not using the default WordPress Login page, wp-login.php. 

How can I resolve this issue? Some options: 

  1. Change the login function URL – if this is an option, where can I find that code? 
  2. Change the login box code – if this is an option, where can I find that code? 
  3. Any other options? 

Any feedback on which the simplest approach and instructions is appreciated. 

16 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

I would suggest you can either remove the login form completely and simply utilise whatever login procedures you are already using – or yes – you could change the url for sending the logon details to. Either will require a small edit to one of the forum templates.

We can tell you what to change of course but the first stage would be to create a child theme if you are not already using one – easy, quick and simple (https://simple-press.com/documentation/codex/themes/theme-basics/creating-a-child-theme/) from one of our free frameworks – and then tell us which forum theme you are using so we can target the correct template.

JL Jessica Lopez
Jessica Lopez
Member

We are using a child theme for Reboot. Thank you! 

YS Yellow Swordfish
Yellow Swordfish
Member

And do you want to remove or change the url?

JL Jessica Lopez
Jessica Lopez
Member

I would like to change the URL to utilize our custom login page (https://museumstoreassociation.org/my-account/). 

YS Yellow Swordfish
Yellow Swordfish
Member

You will need to make a small edit to the template display function in the head template. In the parent theme locate the templates folder. Under that are a desktop and a mobile folder each of which has a ‘head’ template (spHeadDesktop.php and spHeadMobile.php).

The first thing needed is to copy these templates to their respective folders in your reboot child theme. 

Then in both templates you will need to make a small edit to the template tag ‘sp_LogInOutButton()’

Update the sp_LogInOutButton template tag from:

sp_LogInOutButton('tagClass=spButton spRight', __sp('Log In'), __sp('Log Out'), __sp('Log in and log out'));

to

sp_LogInOutButton('tagClass=spButton spRight&logInLink=http://yoursite.com/mylogin', __sp('Log In'), __sp('Log Out'), __sp('Log in and log out'));

the change being adding:

&logInLink=http://yoursite.com/mylogin

JL Jessica Lopez
Jessica Lopez
Member

Thank you for your response. I have implemented this on the spHeadDesktop.php. The results were different than I expected, so I apologize if I did not explain clearly.

Here is what is happening now that I’ve modified the code: 
On the forum login page (https://museumstoreassociation.org/shoptalk/) when a user clicks the forum “Log In” button, the top area expands to display the login box (Login Name & Password). It displays for a couple seconds, then automatically refreshes the page to redirect to my site’s login page (https://museumstoreassociation.org/my-account/). 

Here is what I would like to happen: 
On the forum login page (https://museumstoreassociation.org/shoptalk/) when a user clicks the forum “Log In” button, the top area expands to display the login box (Login Name & Password). The user enters their credentials, which routes through our site’s login page (assuming that correctly resolves the issue of the login functionality not working), logs the user in, and returns them to the forum page (https://museumstoreassociation.org/shoptalk/), logged in. 

Please let me know if this approach is possible, and if not, what options I have for accomplishing this login flow for the user. 

YS Yellow Swordfish
Yellow Swordfish
Member

So you definitely do NOT want to use your own replacement login page? Which is what I thought you meant although admittedly missed a step on my instructions to remove the SP front login form.

Can you confirm this please?

JL Jessica Lopez
Jessica Lopez
Member

I do not want the user to have to go to our replacement login page — unless necessary. 

Ideally, they will login using the simple:press login form — but that is not working, presumably because we are not using the default WP login page (wp-login.php). 

Thank you for your help, and please let me know if this needs further clarification. 

YS Yellow Swordfish
Yellow Swordfish
Member

That actually looks like it is not possible (unless my colleague @mr-papa knows of a way) and that surprises me. I am going to suggest we change this so that it can be done.

Until then I think the best we can do is redirect to your own form. And that is working now but you should also comment out the display function:

sp_LoginForm($loginForm);

which will stop the forum form opening.

MP Mr Papa
Mr Papa
Member

Nope… afraid not currently possible without a lot of extra programming..  never had a request to use the WP login form but route the request through a different login processor than WP…

doable, but needs a little love hooking into the wp process…

JL Jessica Lopez
Jessica Lopez
Member

Thank you for taking the time to understand my goals and figure out the best available option.

YS Yellow Swordfish
Yellow Swordfish
Member

I plan to intro this in the next update all being well.

I recall (from a long, long time ago) that the thinking was that if someone had their own login system then they would also probably have their own login button/link – like in a menu or sidebar. But we can do this.

JL Jessica Lopez
Jessica Lopez
Member

Might it work if I try replacing the simple:press login form with our own? So the Login button would expand to display our login form in place. 

If this sounds like a good approach, could you please direct me to the appropriate place in the code? 

YS Yellow Swordfish
Yellow Swordfish
Member

Personally wouldn’t recommend it but it can be done if you really want to take a swing at it…

Our login form source code is at simple-press/forum/content/forms/sp-form-login.php

This could be replaced completely by using a standard WordPress filter named:

‘sph_LoginForm‘

This filter has two parameters. The first is the html already created which your code would replace. The second is the array of control values which you can find at the top of the template you have edited where it says: IN-LINE LOGIN FORM – OBJECT DEFINITION.

So – do you know how to code up WP style filters? If so that might be all you need.