• Resolved gnjang

    (@gnjang)


    hello.
    While running the Ninja Form plugin, I would like to allow administrators with subscriber and contributor privileges, not administrator privileges, to use the Ninja Form submission form.
    Could you please tell me how?

    // 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 'subscriber'; // EDIT: User Capability
    
    }
    
    /**
    
    * 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("subscriber");
    
    return $allowed;
    
    };

    I put the code in function.php as above. However, it only loads as shown in the image below and an error 403 appears..

    I put the code in function.php as above. However, when I select the form, it only loads and a 403 error appears.

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘I wandAdmin see submissions’ is closed to new replies.