diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index b2991b3183..19deda1dd5 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -3003,15 +3003,31 @@ function the_post_password() { */ function favorite_actions() { $actions = array( - 'page-new.php' => __('Add New Page'), - 'edit-comments.php' => __('Manage Comments') + 'post-new.php' => array(__('Add New Post'), 'edit_posts'), + 'page-new.php' => array(__('Add New Page'), 'edit_pages'), + 'edit-comments.php' => array(__('Manage Comments'), 'moderate_comments') ); $actions = apply_filters('favorite_actions', $actions); + + $allowed_actions = array(); + foreach ( $actions as $action => $data ) { + if ( current_user_can($data[1]) ) + $allowed_actions[$action] = $data[0]; + } + + if ( empty($allowed_actions) ) + return; + + $first = array_keys($allowed_actions); + $first = $first[0]; echo '
'; - echo '
' . __('Add New Post') . '
'; + echo '
' . $allowed_actions[$first] . '
'; echo '
'; - foreach ( $actions as $action => $label) { + + array_shift($allowed_actions); + + foreach ( $allowed_actions as $action => $label) { echo "\n";