-
Author
-
June 20, 2018 at 23:25 #201382
maxlevel
ParticipantCan somebody help me to change this php code so not the normal WordPress login window appears but instead the KLEO pop-up with the WordPress Login/Registration?
An account is already registered with your email address. <a href=”/wp-login”> Please Login. </a> Forgot Password? <a href=”/my-account/lost-password”> Click here to get a new one. </a>
June 21, 2018 at 18:05 #201466Radu
ModeratorHi,
There are two ways to show the login pop-up
1. Adding at the end of the link /#show-login example : http://rdu.local/kleo/#show-login
2. Adding this class kleo-show-login to the element that you want to click and to appear the pop-up.
COPY CODE<a href="http://rdu.local/kleo" class="kleo-show-login">Login</a>Cheers
RHi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionJune 22, 2018 at 22:39 #201598maxlevel
ParticipantIs that true that method 1 is php and method 2 html?
I would need the php version.
June 22, 2018 at 22:44 #201599maxlevel
ParticipantI want to replace a line in a php file and want to show a link with the Ajax pop-up.
Would that be the right code?:
before: Please Login
after: Please LoginJune 22, 2018 at 22:51 #201600maxlevel
ParticipantOh sorry I didn’t put in the code as code:
here it is:
before:<a href=”/wp-login”> Please Login.
after:<a href=”/wp-login/#show-login”> Please Login.By the way. Can I edit my posts? I didn’t find a way to do so.
June 25, 2018 at 16:52 #201875Radu
ModeratorHi,
The php version it’s something like this
COPY CODEecho ' <a href="/wp-login/"></a> ';Cheers
RHi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionSeptember 12, 2018 at 20:17 #209464maxlevel
ParticipantHi.
I need to reopen this post because I am still having troubles with this problem. I don’t understand code well enough to know how exactly to implement your suggestion.Basically, what I want to do is rewrite an error message during checkout. At the moment it says “An account is already registered with your email address. Please log in”.
I want to change the text a bit (which I know how to do) and my customers to be able to click on “Please log in” and I want the login widget to pop up. How exactly do that?
I’ve only managed to send them to another site where the widget pops up but I don’t want them to leave the checkout page.
This is the bit of Code I am working with in the Theme Functions php file:
COPY CODE/* ================= Woocommerce Email is already registered - Please Log in =================== */ function my_woocommerce_add_error( $error ) { return str_replace('An account is already registered with your email address. Please log in','Hi, you must be a returning customer. To keep your data safe login is required to purchase a membership. If you know your password <a href="/wp-login/???????"> Please Login</a> ',$error); } add_filter( 'woocommerce_add_error', 'my_woocommerce_add_error' );What do I need to do here?
Thanks for your help!
Rudolf
September 13, 2018 at 13:49 #209501Radu
ModeratorHi,
COPY CODE<a class="kleo-show-login " href="#">Open Login</a>Will generate this :

The pop-up will be shown if you are logged out !
So there you will add the above insteadCOPY CODE<a href="/wp-login/???????"> Please Login</a>Cheers
RHi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionSeptember 14, 2018 at 05:05 #209577maxlevel
ParticipantThanks for your reply! This works in html but not in php.
How do I get this to work in my Theme Functions php file?Thanks,
RudolfSeptember 14, 2018 at 18:10 #209617Radu
ModeratorHi,
I had tested the snippet from you and adding the link that i had suggested to you and it works

I had printed the output of the function and it works… make sure to be logged out for showing the login popup
COPY CODEfunction my_woocommerce_add_error( $error ) { return str_replace( 'An account is already registered with your email address. Please log in', 'Hi, you must be a returning customer. To keep your data safe login is required to purchase a membership. If you know your password <a class="kleo-show-login" href="#">Please Login</a> ' ,$error); } add_filter( 'woocommerce_add_error', 'my_woocommerce_add_error' );Cheers
RHi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionSeptember 17, 2018 at 23:39 #209774maxlevel
ParticipantHi Radu,
it doesn’t work in the functions php file.I have deactivated ALL plugins (except Woocommerce) on my staging site and deleted all other custom functions in the php file and copy&pasted the exact code from your last reply in the file.
When I try to check out and recreate the error message by trying to buy a subscription product with an already registered email address or create an account with an already registered email address. The custom message shows up like it should but the “Please Login” links doesn’t cause the login window to pop up.
All that happens when I click the link is that is jumps to the top of the page.
I recorded it here:
https://drive.google.com/file/d/1gVAu-w1JCXsfb0iYco3YNhPiqS7IuSES/view
I made sure I was logged out and used an incognito window for the test.
I am using the Kleo Child Theme.
I hope you can help.
Thanks,
RudolfSeptember 20, 2018 at 16:01 #209987Radu
ModeratorHi,
In this case maybe that wooocommerce filter doesn’t not allow content with html class or any attribute, that’s the correct html structure that opens the pop-up.
So you will have to ask the woocommerce team how you can allow this type of content on their filter.
COPY CODE<a class="kleo-show-login" href="#">Please Login</a>Cheers
RHi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution -
AuthorPosts
The forum ‘General questions’ is closed to new topics and replies.