No commits for the Author
authorSteve Sutton <steve@gaslightmedia.com>
Tue, 19 Jul 2016 12:09:40 +0000 (08:09 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Tue, 19 Jul 2016 12:09:40 +0000 (08:09 -0400)
Also no server stats.
Test for edit_others_posts
if not set then they are an Author and should only see posts and media

Gaslightify.php

index b54ee0e..73e28c2 100755 (executable)
@@ -32,7 +32,7 @@ function interface_client_safeguard() {
             wp_enqueue_style('GaslightifyMultiSiteStyle', plugins_url('css/GaslightifyMultiSite.css', __FILE__));
         }
     }
-    if (!current_user_can('edit_posts')) {
+    if ( !current_user_can( 'edit_posts' ) ) {
         ?>
         <style type="text/css">
             #menu-posts, #menu-comments {
@@ -41,6 +41,15 @@ function interface_client_safeguard() {
         </style>
         <?php
     }
+    if ( !current_user_can( 'edit_others_posts' ) ) {
+        ?>
+        <style type="text/css">
+            #menu-comments {
+                display: none !important;
+            }
+        </style>
+        <?php
+    }
     wp_enqueue_style('GaslightifyGlobalStyle', plugins_url('css/GaslightifyGlobal.css', __FILE__));
     add_editor_style( 'scss/admin/tinymce.css' );
 }
@@ -164,9 +173,11 @@ function glm_stats(){
 ';
 }
 function Gaslightify_menu() {
-    add_menu_page('Server Stats', 'Server Stats', 'edit_posts', 'glm_stats', 'glm_stats', 'dashicons-chart-area');
-    if (class_exists('Ninja_Forms')) {
-        add_menu_page('Form Submissions', 'Form Submissions', 'edit_posts', 'edit.php?post_type=nf_sub', '', 'dashicons-feedback');
+    if ( current_user_can( 'edit_others_posts' ) ) {
+        add_menu_page('Server Stats', 'Server Stats', 'edit_posts', 'glm_stats', 'glm_stats', 'dashicons-chart-area');
+        if (class_exists('Ninja_Forms')) {
+            add_menu_page('Form Submissions', 'Form Submissions', 'edit_posts', 'edit.php?post_type=nf_sub', '', 'dashicons-feedback');
+        }
     }
 }
 add_action('admin_menu', 'Gaslightify_menu');