Making popup forms require login

Recently one of our customers asked to make the popup forms for send to friend and send enquiry only available to logged in users, we wrote a small snippet of code for it and though we would share it. (this code would be placed in you child theme functions.php file)

Now when trying to open one of the send to friend or send enquiry forms you are shown a message and given an option to login/register, if the link is clicked you will be taken to the login page and then redirected back to the original page.

(From GeoDirectory 1.6.3+ when redirected back the popup form will automatically open up)


The GeoDirectory Team

Published by Stiofan O'Connor

Stiofan O'Connor is the co-founder and CEO of AyeCode LTD. With his business partner Paolo, they are the makers of the GeoDirectory, UsersWP and Invoicing plugins for WordPress. He is a Full Stack developer specialized in WordPress development. Stiofan started building websites as a hobby in the early 2000s with PHP at first. He then moved to the CodeIgniter Web Framework for a while before discovering WordPress and ever since he never looked back. Today his WordPress themes and plugins are used with success by +100.000 active websites.