Support » Plugin: SimpleModal Login » [Plugin: SimpleModal Login] Pop login from javascript

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Eric Martin

    (@emartin24)

    Because SimpleModal Login binds the click event to the simplemodal-login class, with jQuery you can trigger the event with:

    jQuery('.simplemodal-login').trigger('click.simplemodal-login');

    Hope that helps.

    -Eric

    Thanks!

    Hmm, I celebrated too soon. One issue that arose now is that redirection is taking user after login to wordpress administration backend. That is undesired behavior. When using php function call I can provide the parameter where to go after login:

    wp_loginout($_SERVER['REQUEST_URI']);

    but with jquery call I can’t provide the redirect parameter. When I place alert() call in the default.js after the:

    s.url = this.href;
    alert(s.url);

    it pops 3 times with following paths:

    http://new.domain.com/login/?redirect_to=%2F
    http://new.domain.com/login/
    http://new.domain.com/login/

    It seems my jquery call parameters are overridden by 2 subsequent additional calls and “http://new.domain.com/login/?redirect_to=%2F” path is lost. When I use just the regular href login link, alert() pops only 1 time showing correct redirect link:

    http://new.domain.com/login/?redirect_to=%2F

    Any idea what other 2 calls is jQuery('.simplemodal-login').trigger('click.simplemodal-login') triggering and how to prevent it? Or alternatively, is there a way to provide a redirect parameter to jquery to ensure correct redirection after the form is submitted?

    This is what I ended up doing.

    var ref = jQuery("input[name='_wp_original_http_referer']").val();
    jQuery('#loginform').append(jQuery('<input type="hidden" name="redirect_to">').val(unescape(ref)));
    jQuery('.simplemodal-login').trigger('click.simplemodal-login');

    not sure if it is the most elegant way to do it but it works.

    dk-andersson

    (@dk-andersson)

    Help me!!!!

    I have tride your script

    jQuery(‘.simplemodal-login’).trigger(‘click.simplemodal-login’);

    This is not working for me why??? Do I need to put som more kode in to
    trigger click onload??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: SimpleModal Login] Pop login from javascript’ is closed to new replies.