From 20c979050f0c6641f7916738969f40560e815b71 Mon Sep 17 00:00:00 2001 From: Matt Mullenweg Date: Thu, 18 Nov 2004 19:51:31 +0000 Subject: [PATCH] Fail more gracefully for lower level users git-svn-id: https://develop.svn.wordpress.org/trunk@1862 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/admin-functions.php | 14 +++++++++----- wp-admin/categories.php | 16 ++++++++++------ wp-admin/moderation.php | 12 ++++++------ 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index 16ea74ddab..32f28b1ca0 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -106,22 +106,26 @@ function dropdown_categories($default = 0) { // Dandy new recursive multiple category stuff. function cat_rows($parent = 0, $level = 0, $categories = 0) { - global $wpdb, $bgcolor; - if (!$categories) { + global $wpdb, $bgcolor, $user_level; + if (!$categories) $categories = $wpdb->get_results("SELECT * FROM $wpdb->categories ORDER BY cat_name"); - } + if ($categories) { foreach ($categories as $category) { if ($category->category_parent == $parent) { $category->cat_name = htmlspecialchars($category->cat_name); $count = $wpdb->get_var("SELECT COUNT(post_id) FROM $wpdb->post2cat WHERE category_id = $category->cat_ID"); $pad = str_repeat('— ', $level); - + if ( $user_level > 3 ) + $edit = "" . __('Edit') . "cat_name)) . "')\" class='delete'>" . __('Delete') . ""; + else + $edit = ''; + $class = ('alternate' == $class) ? '' : 'alternate'; echo "$category->cat_ID$pad $category->cat_name $category->category_description $count - " . __('Edit') . "cat_name)) . "')\" class='delete'>" . __('Delete') . " + $edit "; cat_rows($category->cat_ID, $level + 1); } diff --git a/wp-admin/categories.php b/wp-admin/categories.php index 235ba2008d..b384437742 100644 --- a/wp-admin/categories.php +++ b/wp-admin/categories.php @@ -112,10 +112,8 @@ break; default: - require_once ('admin-header.php'); - if ($user_level < 3) { - die(sprintf(__("You have no right to edit the categories for this blog.
Ask for a promotion to your blog admin. :)"), get_settings('admin_email'))); - } +require_once ('admin-header.php'); + $messages[1] = __('Category added.'); $messages[2] = __('Category deleted.'); $messages[3] = __('Category updated.'); @@ -126,7 +124,11 @@ $messages[3] = __('Category updated.');
-

add new)'), '#addcat') ?>

+ 3 ) : ?> +

add new)'), '#addcat') ?>

+ +

+ @@ -142,6 +144,7 @@ cat_rows(); + 3 ) : ?>

Note:
Deleting a category does not delete posts from that category, it will just @@ -165,8 +168,9 @@ set them back to the default category %s.'), get_catname(1)) ?>

+ - Your level is not high enough to moderate comments.

')); - } - if (isset($deleted) || isset($approved) || isset($ignored)) { echo "
\n

"; if ($approved) { @@ -107,8 +103,12 @@ if (isset($deleted) || isset($approved) || isset($ignored)) { ?>

+ get_results("SELECT * FROM $wpdb->comments WHERE comment_approved = '0'"); +if ($user_level > 3) + $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_approved = '0'"); +else + $comments = ''; if ($comments) { // list all comments that are waiting for approval @@ -152,7 +152,7 @@ echo " comment_post_ID Currently there are no comments to be approved.

") . "\n"; + echo __("

Currently there are no comments for you to moderate.

") . "\n"; } ?>