Add Form Submissions menu to wp admin
authorSteve Sutton <steve@gaslightmedia.com>
Wed, 22 Apr 2015 18:56:50 +0000 (14:56 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Wed, 22 Apr 2015 18:56:50 +0000 (14:56 -0400)
So editor role can have access to the Ninja Form submissions.

Gaslightify.php
css/Gaslightify.css
css/GaslightifyAdmin.css

index 0d0704d..89fd7b5 100755 (executable)
@@ -163,7 +163,17 @@ function glm_stats(){
 }
 function Gaslightify_menu() {
     add_menu_page('Server Stats', 'Server Stats', 'edit_posts', 'glm_stats', 'glm_stats', 'dashicons-chart-area');
+    add_menu_page('Form Submissions', 'Form Submissions', 'edit_posts', 'edit.php?post_type=nf_sub', '', 'dashicons-feedback');
 }
 add_action('admin_menu', 'Gaslightify_menu');
-
+/* 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' );
 ?>
index da03823..4ee80eb 100755 (executable)
@@ -27,6 +27,7 @@ select[name="seo_filter"],
 #metaslider_social,
 .ngg_admin_notice,
 #wpbody .updated,
+#toplevel_page_ninja-forms,
 .cms_tpv_promo_above_wrapper {
     display: none !important;
 }
@@ -37,4 +38,4 @@ select[name="seo_filter"],
 
 #wpadminbar #toplevel_page_metaslider .dashicons-before:before {
        content: "\f233" !important;
-}
\ No newline at end of file
+}
index c5605a4..acf53b1 100644 (file)
@@ -11,4 +11,7 @@ and open the template in the editor.
 
 #wpadminbar #toplevel_page_metaslider .dashicons-before:before {
        content: "\f233" !important;
-}
\ No newline at end of file
+}
+#toplevel_page_edit-post_type-nf_sub {
+    display: none;
+}