Grant Ninja Forms Backend Access to Non-Admins

Update 2020-02-11: The latest Ninja Forms update improved the security of the plugin. That’s why the following code does not work anymore. Ninja Forms knows about the problem and made this topic to a “Top Issue”, see here.

By default, only Administrator users have access to the Ninja Forms backend pages. If you want to grant access to users with another permission level (e.g. Editor), you can change this by adding some of the following lines to a plugin or theme. To enable access to all forms, add:

add_filter( 'ninja_forms_admin_parent_menu_capabilities', 'custom_nf_capabilities' );
add_filter( 'ninja_forms_admin_all_forms_capabilities', 'custom_nf_capabilities' );

function custom_nf_capabilities( $cap ) {
    return 'edit_others_pages'; // Set desired user capability
}

Have a look at this page to find a matching capability.

Submissions

Access to the submissions can be granted by adding this line:

add_filter( 'ninja_forms_admin_submissions_capabilities', 'custom_nf_capabilities' );

New Forms

Access to new forms can be granted by:

add_filter( 'ninja_forms_admin_add_new_capabilities', 'custom_nf_capabilities' );

Import / Export

Access to the Import/Export submenu can be granted by:

add_filter( 'ninja_forms_admin_import_export_capabilities', 'custom_nf_capabilities' );

Settings

Access to the settings page can be granted by:

add_filter( 'ninja_forms_admin_settings_capabilities', 'custom_nf_capabilities' );

Excel Export

Access to the Excel Export can be granted by:

add_filter( 'ninja_forms_admin_excel_export_capabilities', 'custom_nf_capabilities' );

Leave a Comment