• Resolved whereverpanda

    (@whereverpanda)


    Hi guys,

    Since updating to 3.6.2 no one but admin can load submissions (submissions page loads, but loader just turning when selecting a form).

    I’m not sure if it was 3.6.2 or 3.6.1 that broke this, but I rolled back to 3.6.0 and roles other than Administrator can load submissions again.

    Can you please check into this?

    Thanks!

Viewing 2 replies - 16 through 17 (of 17 total)
  • This one definitely threw our team for a loop.

    I tried adding these to the functions.php but it doesn’t seem to resolve the issue.
    In fact, it just keeps causing critical errors…
    How is this code meant to be applied?

    hopefully it doesn’t have to be manually updated every update?

    • This reply was modified 2 years, 11 months ago by supaiku.
    Thread Starter whereverpanda

    (@whereverpanda)

    @supaiku

    Hi there,

    I am 100% with you on them having to have informed us regarding the change and hopefully, if this DOES change again in a future update, they will let us know. But they have apologized for this and stated that they will keep the community informed. This is a feature I’m still hoping they build in to NF’s core settings settings.

    I genuinely hope the method I’m going to describe below will help you, because I am not a coder I wouldn’t know how to fix it if it does in fact change again!

    As far as I know the code can be put into your theme’s functions.php file, but because I use Oxygen Builder, I use the Code Snippets plugin. I also use Publishpress Permissions for capability settings.

    I add a capability in Publishpress Permissions called ‘access_forms’, so in my code below, change that to your desired capability:

    I add a new Code Snippet and paste this into it:

    // 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 'access_forms'; // 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("access_forms");
      
      return $allowed;
    };


    VERY IMPORTANT:
    If you are using Code Snippets, set it to run everywhere!

    I really hope this helps you!!

    • This reply was modified 2 years, 11 months ago by whereverpanda.
Viewing 2 replies - 16 through 17 (of 17 total)
  • The topic ‘Latest Update lets no one but Admin see submissions’ is closed to new replies.