I’m developing a login plugin and need to test the login form that pops up after a session has expired.
I would like to see the popup appear on my request. Any hack is fine. Ideally some little javascript to run from the console.
2 Answers
I’ve discovered the following stuff.
This kind of login is called internally Interim. It works thanks to the continuous polling offered by the Heartbeat API. The prefix of the expired session functionality is wp-auth-check and the important bit for me was a little script at /wp-includes/js/wp-auth-check.js.
When the auth check request is sent to the server, the response will contain a true if the session is active or a false if it has expired. Based on that, the script decides if it has to show the modal login or not. Given that all is managed by events, it is sufficient to trigger one like this
jQuery(document).trigger('heartbeat-tick.wp-auth-check', [ {'wp-auth-check': false} ])
to make the dialog box appear.