Forums

SimpleModal Login
howto invoke the modal login directly from PHP (2 posts)

  1. flymike
    Member
    Posted 1 year ago #

    I have a custom page template which forces a login if not currently logged in.
    It uses the PHP header() function, as in:

    header("Location: /wp-login.php");

    But this bypasses SimpleModal Login.
    How can I invoke the modal login from PHP?

  2. Eric Martin
    Member
    Posted 1 year ago #

    @flymike - since SimpleModal Login is a client-side modal, you are going to have to find a creative "work around" to make this work.

    There are a number of different options, but here's one that might be the easiest to implement:

    Place this JavaScript in your theme:

    <script>
    jQuery(function ($) {
        if(window.location.hash === "#login") {
            $('.simplemodal-login').trigger('click.simplemodal-login');
        }
    });
    </script>

    Update your redirect to include the login hash:

    header("Location: /index.php#login");

    Hope that helps.

    -Eric

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic