[How To] allow Editors and Administrators to Maintain the Ninja Forms

[How To] allow Editors and Administrators to Maintain the Ninja Forms

Ninja Forms is a free, fast and really efficient form builder. Unfortunately, Ninja Forms’ developers have locked WordPress roles, enabling only Administrators to view submissions or bring about some changes in the forms.

While working for one of my client’s website, I was really freaked out to see this, as I do not want all the users to have rights like administrators. In my case, I wanted to allow admins as well as editor to create and maintain forms. This is how I added some tweaks in the plugin, follow step by step:

  • FTP login to your website (by FileZilla) and create a new folder: ‘wp-content/plugins/my_custom_change_ninja_forms_all_forms_capabilities_filter’
  • Open the newly created folder and create an empty file ‘my_custom_change_ninja_forms_all_forms_capabilities_filter.php’
  • Edit that empty file, and paste at the top:
<?php
/*
Plugin Name: my_custom_change_ninja_forms_all_forms_capabilities_filter
*/
  •  Add this code just below the above code:

// To give Editors access to the ALL Forms menu
function my_custom_change_ninja_forms_all_forms_capabilities_filter( $capabilities ) {
    $capabilities = "edit_pages";
    return $capabilities;
}
add_filter( 'ninja_forms_admin_parent_menu_capabilities', 'my_custom_change_ninja_forms_all_forms_capabilities_filter' );
add_filter( 'ninja_forms_admin_all_forms_capabilities', 'my_custom_change_ninja_forms_all_forms_capabilities_filter' );
// To give Editors access to ADD New Forms
function my_custom_change_ninja_forms_add_new_capabilities_filter( $capabilities ) {
    $capabilities = "edit_pages";
    return $capabilities;
}
add_filter( 'ninja_forms_admin_parent_menu_capabilities', 'my_custom_change_ninja_forms_add_new_capabilities_filter' );
add_filter( 'ninja_forms_admin_add_new_capabilities', 'my_custom_change_ninja_forms_add_new_capabilities_filter' );

/* To give Editors access to the Submissions - Simply replace ‘edit_posts’ in the code snippet below with the capability
that you would like to attach the ability to view/edit submissions to.Please note that all three filters are needed to
provide proper submission viewing/editing on the backend!
*/
function nf_subs_capabilities( $cap ) {
    return 'edit_posts';
}
add_filter( 'ninja_forms_admin_submissions_capabilities', 'nf_subs_capabilities' );
add_filter( 'ninja_forms_admin_parent_menu_capabilities', 'nf_subs_capabilities' );
add_filter( 'ninja_forms_admin_menu_capabilities', 'nf_subs_capabilities' );

// To give Editors access to the Import/Export Options
function my_custom_change_ninja_forms_import_export_capabilities_filter( $capabilities ) {
    $capabilities = "edit_pages";
    return $capabilities;
}
add_filter( 'ninja_forms_admin_parent_menu_capabilities', 'my_custom_change_ninja_forms_import_export_capabilities_filter' );
add_filter( 'ninja_forms_admin_import_export_capabilities', 'my_custom_change_ninja_forms_import_export_capabilities_filter' );

// To give Editors access to the the Settings page
function my_custom_change_ninja_forms_settings_capabilities_filter( $capabilities ) {
    $capabilities = "edit_pages";
    return $capabilities;
}
add_filter( 'ninja_forms_admin_parent_menu_capabilities', 'my_custom_change_ninja_forms_settings_capabilities_filter' );
add_filter( 'ninja_forms_admin_settings_capabilities', 'my_custom_change_ninja_forms_settings_capabilities_filter' );
  • Go to your WordPress Dashboard Plugins page and see that there is now a new plugin listed – called ‘my_custom_change_ninja_forms_settings_capabilities_filter’
  • Simply activate the plugin and Woah you are done. Now, editors along with administrators can bring about changes in the forms and also see the user submissions.
Disclaimer: As the next update by developers approaches, this tweak would be deleted automatically. Ninja Forms plugin is devoted to be used by Admins only,  kindly allow the permission only to people whom you trust. Before all of the above mentioned tweaks don’t forget to backup your site. The above mentioned code was found on WordPress support forum. If you want to report anything about this article, kindly email: [email protected]

About the Author

  • This method doesn’t work with the Ninja form last version, do you have a solution for this ?

    • This method will stop working after you update the plugin, so you shouldn’t update plugin.

  • sevensixmedia

    how can i give an editor acces to the excel export menu item?