In recent versions of WordPress, when you have been logged in to the dashboard a while with the page still open, WordPress times out your session and opens a login box. This box appears in a little popup and allows you to login without having to refresh the page. Does anyone know if there is a built in way to utilize this popup in the frontend?

I have a link that requires a user to be logged in in order for it to have any action. When a user is not logged in, I want a popup login form to assist with this and I'm hoping there is an easy way already so I don't need to follow some of these older tutorials and do everything manually because that sometimes makes it harder to maintain compatibility with future versions.

Thanks for any advice offered!

My recommendation would be to use a plug-in like Lightbox Plus to power your link. Clicking the link would load your standard login form inside a lightbox. You could then automatically redirect to the same page so that, once logged in, users can leave a comment.

Basically, you'd dynamically build your link to be something link this:

<a href="http://yoursite.com/wp-login.php?redirect_to=http%3A%2F%2Fyoursite.com%2Fpostname" rel="lightbox[login-form]" itle="Please login to comment">Login to Comment</a>

This would load the login form in a lightbox and set it to redirect to the post upon successful authentication. This might be all you need, but I haven't tested it ... so give it a try and, if needed, add some other scripts to reload the page upon successful login.

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.