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?
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?
@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
This topic has been closed to new replies.