JetFormBuilder Login Restriction with Exempt Forms
Snippet Description
This script restricts JetFormBuilder form submissions to logged-in users. If a visitor is not logged in, it hides the form’s submit button and displays a styled message with “Log In” and “Sign Up” links. Specific form IDs can be exempted from this rule by listing them in the configuration array.
Usage Instructions
- Copy and paste this snippet into WP Code Snippets.
- Set it to load on the front-end of your site.
- Update the
exemptFormNumsarray with the JetFormBuilderform_idvalues you want to allow without login. Example:const exemptFormNums = ['3376', '2901', '4120'];
- If needed, update the
loginUrlandregUrlconstants with your site’s actual login and registration URLs. - Save and activate the snippet.
- Test while logged out and logged in to ensure exempt forms still show their submit button while others are restricted.