Answers.Body: <p>We can use the caldera forms caldera_forms_manage_cap hook to grant access to specific users without giving them access to any other plugins.</p>
  <p>In order for this solution to work, you will need to install two addtional plugins:</p>
  <ul>
  <li>Members by MemberPress <a href="https://wordpress.org/plugins/members/" rel="nofollow noreferrer">https://wordpress.org/plugins/members/</a></li>
  <li>Code Snippets by Code Snippets Pro <a href="https://wordpress.org/plugins/code-snippets/" rel="nofollow noreferrer">https://wordpress.org/plugins/code-snippets/</a></li>
  </ul>
  <p>MEMBERS PLUGIN</p>
  <p>Once Members is installed and activated, go to the Members SETTINGS page and check the Multiple User Roles box &quot;Allow users to be assigned more than a single role.&quot;</p>
  <p>Go to Members ADD NEW ROLE and create a new role called &quot;Caldera Forms Access&quot;. This new role should only have 1 capability granted which is READ, and it should show the role as &quot;caldera_forms_access&quot;.</p>
  <p>Now add a new Custom Capability to the role called &quot;caldera_forms_manage_options&quot; and make sure GRANT is checked and then save the role.</p>
  <p>The saved role should show as &quot;caldera_forms_access&quot; and say that it has 2 Granted capabilities.</p>
  <p>CODE SNIPPETS PLUGIN</p>
  <p>Once Code Snippets is installed and activated, ADD NEW snippet called Caldera Forms Access and copy and paste the following:</p>
  <pre><code>///////////////////////////////////////////////////////////////////////////////
  /*** Grant access to Caldera Forms plugin options/admin page by Jeff Sherk ***/
  ///////////////////////////////////////////////////////////////////////////////
  // CF requires manage_options capability in order to access the options/admin page.
  // This code will allow users that do not have manage_options capability to access it.
  // (1) From the MEMBERS plugin, go to Add New Role and create a role (should have 1 capability of READ=grant) and call the new role &quot;caldera_forms_access&quot;.
  // (2) Edit this new role and add a custom capability called &quot;caldera_forms_manage_options&quot; (grant must be checked).
  // (3) Assign the role to the user you want to have access.
  add_filter( 'caldera_forms_manage_cap', function( $cap, $context ) {
      if ( $cap == &quot;manage_options&quot; &amp;&amp; is_user_logged_in() ) { // A request to CF that requires manage_options was made.
          $user = wp_get_current_user();
          $roles = (array)$user-&gt;roles;
          if ( in_array(&quot;caldera_forms_access&quot;, $roles) ) { // Does user have the custom role we created that they need to get access?
              $cap = &quot;caldera_forms_manage_options&quot;; // Change the capability to the custom one we added in the custom role.
          } else {
              // If they do not have the custom role, then do nothing. Users that already have the manage_options capability will still be able to access the plugin as before.
          }
      }
      return $cap;
  }, 10, 2 );
  </code></pre>
  <p>Make sure to SAVE and ACTIVATE the snippet.</p>
  <p>GRANT ACCESS</p>
  <p>Now go to any users profile that needs access, under their User Roles section of their profile you can check the Caldera Forms Access box, and save the change, and they should be good to go!</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-04-08T15:03:20.797Z
Answers.LastActivityDate: 2023-04-08T15:03:20.797Z
Answers.UserDisplayName: jsherk
Body: <p>I understand that Caldera Forms was sunset a while ago, but that there is a version still available for CiviCRM, which I am using.</p>
  <p>On WordPress, I have some CiviCRM users that I want to also be able to access the Caldera Forms plugin/admin page, but this would require giving them the manage_options capability which would then allow them access to ALL plugins, which I do not want.</p>
  <p>How can I grant them access to Caldera Forms plugin only, without having access to other plugins?</p>
  
Tags: <wordpress><caldera-forms>
Title: Caldera Forms access plugin options/admin page without accessing other plugins
ThreadText: # Caldera Forms access plugin options/admin page without accessing other plugins
  
  (Asked by: username_0 on 2023-04-08)
  
  I understand that Caldera Forms was sunset a while ago, but that there is a version still available for CiviCRM, which I am using.
  
  On WordPress, I have some CiviCRM users that I want to also be able to access the Caldera Forms plugin/admin page, but this would require giving them the manage\_options capability which would then allow them access to ALL plugins, which I do not want.
  
  How can I grant them access to Caldera Forms plugin only, without having access to other plugins?
  
  **Tags:** wordpress, caldera-forms
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2023-04-08. Score: 1 | Accepted answer
  
  We can use the caldera forms caldera\_forms\_manage\_cap hook to grant access to specific users without giving them access to any other plugins.
  
  In order for this solution to work, you will need to install two addtional plugins:
  
  * Members by MemberPress <https://wordpress.org/plugins/members/>
  * Code Snippets by Code Snippets Pro <https://wordpress.org/plugins/code-snippets/>
  
  MEMBERS PLUGIN
  
  Once Members is installed and activated, go to the Members SETTINGS page and check the Multiple User Roles box "Allow users to be assigned more than a single role."
  
  Go to Members ADD NEW ROLE and create a new role called "Caldera Forms Access". This new role should only have 1 capability granted which is READ, and it should show the role as "caldera\_forms\_access".
  
  Now add a new Custom Capability to the role called "caldera\_forms\_manage\_options" and make sure GRANT is checked and then save the role.
  
  The saved role should show as "caldera\_forms\_access" and say that it has 2 Granted capabilities.
  
  CODE SNIPPETS PLUGIN
  
  Once Code Snippets is installed and activated, ADD NEW snippet called Caldera Forms Access and copy and paste the following:
  
  ```
  ///////////////////////////////////////////////////////////////////////////////
  /*** Grant access to Caldera Forms plugin options/admin page by Jeff Sherk ***/
  ///////////////////////////////////////////////////////////////////////////////
  // CF requires manage_options capability in order to access the options/admin page.
  // This code will allow users that do not have manage_options capability to access it.
  // (1) From the MEMBERS plugin, go to Add New Role and create a role (should have 1 capability of READ=grant) and call the new role "caldera_forms_access".
  // (2) Edit this new role and add a custom capability called "caldera_forms_manage_options" (grant must be checked).
  // (3) Assign the role to the user you want to have access.
  add_filter( 'caldera_forms_manage_cap', function( $cap, $context ) {
      if ( $cap == "manage_options" && is_user_logged_in() ) { // A request to CF that requires manage_options was made.
          $user = wp_get_current_user();
          $roles = (array)$user->roles;
          if ( in_array("caldera_forms_access", $roles) ) { // Does user have the custom role we created that they need to get access?
              $cap = "caldera_forms_manage_options"; // Change the capability to the custom one we added in the custom role.
          } else {
              // If they do not have the custom role, then do nothing. Users that already have the manage_options capability will still be able to access the plugin as before.
          }
      }
      return $cap;
  }, 10, 2 );
  
  ```
  
  Make sure to SAVE and ACTIVATE the snippet.
  
  GRANT ACCESS
  
  Now go to any users profile that needs access, under their User Roles section of their profile you can check the Caldera Forms Access box, and save the change, and they should be good to go!
  
  
  ---
  
  