-
-
Save New0/06d5b7664a8cfbb256a13bc68de0aa98 to your computer and use it in GitHub Desktop.
<?php | |
/** | |
* Filter hook used in the API route permission callback to retrieve submissions | |
* | |
* return bool as for authorized or not. | |
*/ | |
add_filter( 'ninja_forms_api_allow_get_submissions', 'nf_define_permission_level', 10, 2 ); | |
add_filter( 'ninja_forms_api_allow_delete_submissions', 'nf_define_permission_level', 10, 2 ); | |
add_filter( 'ninja_forms_api_allow_update_submission', 'nf_define_permission_level', 10, 2 ); | |
add_filter( 'ninja_forms_api_allow_handle_extra_submission', 'nf_define_permission_level', 10, 2 ); | |
add_filter( 'ninja_forms_api_allow_email_action', 'nf_define_permission_level', 10, 2 ); | |
function nf_define_permission_level() { | |
$allowed = \current_user_can("delete_others_posts"); | |
return $allowed; | |
} |
Hello @Banilancer you can use this code in the functions.php file of your (child-) theme or in a custom plugin if you add the plugin header information at the top of this file and upload it in the plugins folder of your WP installation.
Thanks New0 and ouija for this help - this update has really caused some issues for my clients situation - following on from Banilancer, can/do I add the...
// Must use all three filters for this to work properly.
add_filter( 'ninja_forms_admin_parent_menu_capabilities', 'nf_subs_capabilities' ); // Parent Menu
add_filter( 'ninja_forms_admin_all_forms_capabilities', 'nf_subs_capabilities' ); // Forms Submenu
add_filter( 'ninja_forms_admin_submissions_capabilities', 'nf_subs_capabilities' ); // Submissions Submenu
function nf_subs_capabilities( $cap ) {
return 'edit_posts'; // EDIT: User Capability
}
...to the functions.php file too. I'm not having much luck as yet. Also are the User_capability and current_user_can related?
@New0 May I know how to implement your code? Is it just put your code into a specific folder or add the code into a specific php file? Many thanks for your help.