Close/Open Popup and Create Cookie After Ninja Forms Submission
Popup Maker Version 1.4+ and Ninja Forms Version 3.0+
The latest versions of Popup Maker and Ninja Forms offer serious quality of life improvements for implementing specific popup behavior on Ninja Forms form submits.
Create Cookie on Form Submit
Create a cookie just like you normally would, except the use the "Ninja Forms Success" Cookie Creation Event, as shown in the below video:
Close a Popup on Form Submit
Access the "Close Popup" Action when you build your form inside the Ninja Forms module, as seen in the below video. If you want your users to see your "Success" message, make sure to set a delay (milliseconds) that is long enough so they can read it.
Open a Popup on Form Submit
Access the "Open Popup" Action when you build your form inside the Ninja Forms module, as seen in the below video:
Previous Versions of Popup Maker and Ninja Forms
If you're using older versions of each plugin, be prepared to use some code - we highly recommend updating to get access the sweet features above!
This solution works for Auto Open/Time Delay, Scroll, and Exit Intent Triggers.
Setup Your Cookie
After clicking Add, you will be able to customize every aspect of how your Cookie will behave. For detailed explanations on all of the Cookie Settings and features, check out the Cookie Settings and Features Doc.
Add the code below to your functions.php - you may want to edit your time value to suit your needs - time is measured in milliseconds: