Last active
October 18, 2020 19:29
-
-
Save Shelob9/60538a46cdb02381570718522f2e85e6 to your computer and use it in GitHub Desktop.
Examples of how to change the capabilities for what kind of user can use Caldera Forms admin via the caldera_forms_manage_cap filter SEE: https://calderaforms.com/doc/caldera_forms_manage_cap/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
Allow users with the editor role to use the Caldera Forms admin screen | |
*/ | |
add_filter( 'caldera_forms_manage_cap', function( $cap, $context ) { | |
if( 'admin' == $context ) { | |
return 'edit_pages'; | |
} | |
return $cap; | |
}, 10, 2 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'caldera_forms_manage_cap', function() { | |
return 'delete_posts'; | |
}, 51 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
Change capability for editting Caldera Forms entires | |
*/ | |
add_filter( 'caldera_forms_manage_cap', function( $cap, $context ) { | |
if( 'edit-entry' == $context ) { | |
//choose a capability of the role you wish to allow | |
return 'create_posts'; | |
} | |
return $cap; | |
}, 10, 2 ); | |
/** | |
Change capability for deleting Caldera Forms entires | |
*/ | |
add_filter( 'caldera_forms_manage_cap', function( $cap, $context ) { | |
if( 'edit-entry' == $context ) { | |
//choose a capability of the role you wish to allow | |
return 'edit_pages'; | |
} | |
return $cap; | |
}, 10, 2 ); | |
I have the same code, it was working for allowing a custom role (With the same privileges as an editor) to view the Caldera Entries. Not it shows the little number saying x entries, but doesn't show the entires themselves?
Maybe an editor cannot create a new form, but only view Caldera form entries...
Is there a solution to allow an editor to create an new form ?
Hi,
any news on that? What to do extactly to allow editors to create and clone forms? Would be great if anybody can help.
No luck with the following code in functions.php:
add_filter('caldera_forms_manage_cap', 'my_caldera_caps', 10, 3);
function my_caldera_caps($cap, $context, $form) {
$cap = 'manage_caldera_forms';
return $cap;
}
/**
Change capability for editting Caldera Forms entires
*/
add_filter( 'caldera_forms_manage_cap', function( $cap, $context ) {
if( 'edit-entry' == $context ) {
//choose a capability of the role you wish to allow
return 'create_posts';
}
return $cap;
}, 10, 2 );
/**
Change capability for deleting Caldera Forms entires
*/
add_filter( 'caldera_forms_manage_cap', function( $cap, $context ) {
if( 'edit-entry' == $context ) {
//choose a capability of the role you wish to allow
return 'edit_pages';
}
return $cap;
}, 10, 2 );
Any luck with this? I haven't been able to resolve this issue.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Allowing editor to create news forms seems not working.
The following code are working only to edit existing forms. But creating a new form is impossible for an editor.
Any ideas ?