-
-
Save Shelob9/60538a46cdb02381570718522f2e85e6 to your computer and use it in GitHub Desktop.
<?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 ); |
<?php | |
add_filter( 'caldera_forms_manage_cap', function() { | |
return 'delete_posts'; | |
}, 51 ); |
<?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 ); | |
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 ?
/**
Allow users with the editor role to edit the Caldera Forms `
*/
add_filter( 'caldera_forms_manage_cap', function( $cap, $context ) {
if( 'admin' == $context ) {
return 'create_posts';
}
return $cap;
}, 10, 2 );
/**
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 );
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.
As far as I know there is no capability called
create_posts
and the example incaldera_forms_manage_cap1.php
above does not work.If you want to use a capability for the editor role I suggest
edit_pages
instead, like this: