• 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)
  • Shaylee

    (@shayleehansen30)

    Now that our User Management add-on can add submission permissions for any role, we strongly encourage this method over file editing.

    Here is our tutorial: https://ninjaforms.com/blog/allow-users-to-edit-wordpress-form-submissions/ ( Allow Users to Edit WordPress Form Submissions )

    If you have questions or need help, do not hesitate to reach out to our Customer Success team. We offer free support to core users so give them a holler ??.

    Thread Starter gnjang

    (@gnjang)

    Is there any way to set it with code?

    • This reply was modified 10 months ago by gnjang.
    Shaylee

    (@shayleehansen30)

    Hello @gnjang,

    While we’d love to provide a simple code snippet for this, Ninja Forms currently doesn’t offer a direct way to adjust submission permissions through custom code.

    That being said, we’re always looking to improve and expand the capabilities of Ninja Forms based on user feedback like yours. Your input is incredibly valuable to us, and it helps shape the future of our product.

    In the meantime, if you’re looking to achieve specific functionality or have any other questions on how to best use Ninja Forms for your needs, our Customer Success team would be more than happy to help explore alternative solutions or provide guidance.

    Thanks again for your understanding and support. We’re here to make sure you get the most out of Ninja Forms!

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