Title: Forms
Last modified: October 30, 2022

---

# Forms

 *  Resolved [noelawill](https://wordpress.org/support/users/noelawill/)
 * (@noelawill)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/forms-56/)
 * Hi
 * Hope you’re well?
 * I think I already know the answer but I’m using WPforms and trying to restrict
   some forms from certqi users, however when I try to create a new restriction 
   using select a form as the option it doesnt work.
 * I’m guessing forms doesnt mean wpforms but if that’s the case which forms is 
   it?
 * Is there any other way I could achieve this?
 * Thank you

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [Daniel Iser](https://wordpress.org/support/users/danieliser/)
 * (@danieliser)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/forms-56/#post-16147611)
 * [@noelawill](https://wordpress.org/support/users/noelawill/) – I’m assuming your
   making restrictions in the settings page, and there are rules for forms.
 * First, those are not rules we are familiar with, so either another plugin has
   written custom code to add those, or my more realistic guess is that WP Forms
   is using post types to store their forms, and for whatever reason have not marked
   them private. Our condition system automatically generates rules for every non-
   private post type.
 * But those rules are applied during rendering of the page on the front end via
   normal the_content and template_redirect filters/actions.
 * I’m assuming they woulnd’t use those to render forms.
 * Our other plugin Popup Maker is similar though marked private, we use post types,
   but not the normal rendering stuff of WP.
 * Likely those targeting options shouldn’t be there.
 *  Thread Starter [noelawill](https://wordpress.org/support/users/noelawill/)
 * (@noelawill)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/forms-56/#post-16155363)
 * [@danieliser](https://wordpress.org/support/users/danieliser/) thank you very
   much for the explanation, I suspected as much.
 * Do.you have any ideas how I could control user access to forms in this case without
   resorting to displaying the form in a post?
 *  Plugin Author [Daniel Iser](https://wordpress.org/support/users/danieliser/)
 * (@danieliser)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/forms-56/#post-16158434)
 * [@noelawill](https://wordpress.org/support/users/noelawill/) – I mean if your
   comfortable hacking your own solution in PHP I might be able to point you to 
   some of our functions that could be used to manually check a specific restriction
   set as a condition to another filter. I haven’t confirmed it would be doable,
   but worth a shot.
 * That is you could theoretically filter the forms rendering methods (not familiar
   with those, you’d have to consult their docs), and not render it if that restriction
   set were to fail.
 *  Thread Starter [noelawill](https://wordpress.org/support/users/noelawill/)
 * (@noelawill)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/forms-56/#post-16166831)
 * Thank you Daniel unfortunately i’m not as capable just yet but I do have the 
   support of someone who probably could do that.
 *  [Bel](https://wordpress.org/support/users/belimperial/)
 * (@belimperial)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/forms-56/#post-16210567)
 * Hi [@noelawill](https://wordpress.org/support/users/noelawill/)
 * We’re sorry for the delayed reply.
 * Glad to hear that you have someone who can help you.
 * Let us know if they need something from us or if you have any questions.
 * Thank you!
 *  Thread Starter [noelawill](https://wordpress.org/support/users/noelawill/)
 * (@noelawill)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/forms-56/#post-16210843)
 * If you could point me to the functions that [@danieliser](https://wordpress.org/support/users/danieliser/)
   mentioned?
 *  Plugin Author [Daniel Iser](https://wordpress.org/support/users/danieliser/)
 * (@danieliser)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/forms-56/#post-16246204)
 * [@noelawill](https://wordpress.org/support/users/noelawill/) – Sorry for the 
   delay.
 * Ok so this is the code we use to redirect a page that they don’t have permission
   for.
 * [https://github.com/code-atlantic/content-control/blob/master/classes/Site/Restrictions.php#L30-L34](https://github.com/code-atlantic/content-control/blob/master/classes/Site/Restrictions.php#L30-L34)
 * You might be able to hack that into a filter of whether the form should render
   or not, but I’m honestly not sure how to tie that to the form post type properly
   so my guess is that directly wouldn’t be the solution.
 * That said if you made a new restriction that didn’t target content, but set the
   user permissions properly, you could theoretically duplicate our restriction 
   check code, choose that restriction by index and skip the “content_check”
 * [https://github.com/code-atlantic/content-control/blob/master/classes/Site/Restrictions.php#L48-L67](https://github.com/code-atlantic/content-control/blob/master/classes/Site/Restrictions.php#L48-L67)
 *     ```
       $restrictions = JP\CC\Options::get( 'restrictions' );
   
       $restriced_content = false;
   
       if ( ! $restrictions || empty( $restrictions ) ) {
       	return $restriced_content;
       }
   
       // first one in list I believe currently, in future they will have actual IDs.
       $restriction = $restrictions[0]; 
   
       $is_restricted = \JP\CC\Is::access_blocked( $restriction['who'], $roles, array( 'context' => 'content_restrictions' ) );
   
       if ( $is_restricted ) {
         // do stuff or don't.
       }
       ```
   
 * Hope that helps, you’ll have to hack it into your stuff from there, but it should
   work in theory.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Forms’ is closed to new replies.

 * ![](https://ps.w.org/content-control/assets/icon-256x256.gif?rev=2968535)
 * [Content Control - The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More](https://wordpress.org/plugins/content-control/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/content-control/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/content-control/)
 * [Active Topics](https://wordpress.org/support/plugin/content-control/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/content-control/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/content-control/reviews/)

 * 10 replies
 * 3 participants
 * Last reply from: [Daniel Iser](https://wordpress.org/support/users/danieliser/)
 * Last activity: [3 years, 6 months ago](https://wordpress.org/support/topic/forms-56/#post-16246204)
 * Status: resolved