diff --git wp-admin/edit-comments.php wp-admin/edit-comments.php
index f5448ab..8b5fbaa 100644
|
|
|
8 | 8 | |
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | 10 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
11 | | if ( ! current_user_can( 'edit_posts' ) ) { |
| 11 | if ( ! current_user_can( 'edit_posts' ) && ! current_user_can( 'edit_comments' ) && ! current_user_can( 'moderate_comments' ) ) { |
12 | 12 | wp_die( |
13 | 13 | '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
14 | 14 | '<p>' . __( 'You are not allowed to edit comments.' ) . '</p>', |
diff --git wp-admin/menu.php wp-admin/menu.php
index f85ebd3..e69e5a9 100644
|
|
$menu[15] = array( __('Links'), 'manage_links', 'link-manager.php', '', 'menu-to |
67 | 67 | |
68 | 68 | // $menu[20] = Pages |
69 | 69 | |
70 | | // Avoid the comment count query for users who cannot edit_posts. |
71 | | if ( current_user_can( 'edit_posts' ) ) { |
| 70 | // Avoid the comment count query for users who cannot moderate_comments. |
| 71 | if ( current_user_can( 'moderate_comments' ) ) { |
72 | 72 | $awaiting_mod = wp_count_comments(); |
73 | 73 | $awaiting_mod = $awaiting_mod->moderated; |
74 | | $menu[25] = array( |
75 | | sprintf( __( 'Comments %s' ), '<span class="awaiting-mod count-' . absint( $awaiting_mod ) . '"><span class="pending-count">' . number_format_i18n( $awaiting_mod ) . '</span></span>' ), |
76 | | 'edit_posts', |
77 | | 'edit-comments.php', |
78 | | '', |
79 | | 'menu-top menu-icon-comments', |
80 | | 'menu-comments', |
81 | | 'dashicons-admin-comments', |
82 | | ); |
83 | | unset( $awaiting_mod ); |
| 74 | $label = sprintf( __( 'Comments %s' ), '<span class="awaiting-mod count-' . absint( $awaiting_mod ) . '"><span class="pending-count">' . number_format_i18n( $awaiting_mod ) . '</span></span>' ); |
| 75 | } else { |
| 76 | $label = __( 'Comments' ); |
| 77 | } |
| 78 | |
| 79 | if ( current_user_can( 'moderate_comments' ) ) { |
| 80 | $cap = 'moderate_comments'; |
| 81 | } elseif ( current_user_can( 'edit_comments' ) ) { |
| 82 | $cap = 'edit_comments'; |
| 83 | } else { |
| 84 | $cap = 'edit_posts'; |
84 | 85 | } |
85 | 86 | |
86 | | $submenu[ 'edit-comments.php' ][0] = array( __('All Comments'), 'edit_posts', 'edit-comments.php' ); |
| 87 | $menu[25] = array( |
| 88 | $label, |
| 89 | $cap, |
| 90 | 'edit-comments.php', |
| 91 | '', |
| 92 | 'menu-top menu-icon-comments', |
| 93 | 'menu-comments', |
| 94 | 'dashicons-admin-comments', |
| 95 | ); |
| 96 | $submenu[ 'edit-comments.php' ][0] = array( __('All Comments'), $cap, 'edit-comments.php' ); |
| 97 | unset( $awaiting_mod, $label, $cap ); |
| 98 | |
87 | 99 | |
88 | 100 | $_wp_last_object_menu = 25; // The index of the last top-level menu in the object menu group |
89 | 101 | |