This topic has 12 replies, 2 voices, and was last updated 6 years by Radu.

  • Author
  • #201382
     maxlevel
    Participant

    Can 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>

    #201383
     maxlevel
    Participant

    With KLEO pop up I mean the AJAX pop up window.

    #201466
     Radu
    Moderator

    Hi,

    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
    R

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #201598
     maxlevel
    Participant

    Is that true that method 1 is php and method 2 html?

    I would need the php version.

    #201599
     maxlevel
    Participant

    I 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 Login

    #201600
     maxlevel
    Participant

    Oh 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.

    #201875
     Radu
    Moderator

    Hi,

    The php version it’s something like this

    COPY CODE
    
    
    echo '
    <a href="/wp-login/"></a>
    ';
    

    echo ‘

    ‘;

    Cheers
    R

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #209464
     maxlevel
    Participant

    Hi.
    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

    #209501
     Radu
    Moderator

    Hi,

    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 instead

    COPY CODE
    
    <a href="/wp-login/???????">
     Please Login</a>
    

    Cheers
    R

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #209577
     maxlevel
    Participant

    Thanks 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,
    Rudolf

    #209617
     Radu
    Moderator

    Hi,

    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 CODE
    
    
    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 class="kleo-show-login" href="#">Please Login</a>
    '
    ,$error);
    }
    add_filter( 'woocommerce_add_error', 'my_woocommerce_add_error' );
    
    

    Cheers
    R

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #209774
     maxlevel
    Participant
    This reply has been set as private.
    #209987
     Radu
    Moderator

    Hi,

    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
    R

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
Viewing 13 posts - 1 through 13 (of 13 total)

The forum ‘General questions’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?