summaryrefslogtreecommitdiffstats
path: root/wp-inst/wp-includes/functions-post.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2005-07-15 11:12:16 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2005-07-15 11:12:16 +0000
commit8a682722d1b64ba299997ff3f6099db353fab43a (patch)
treef5e794047b9e92676e44100cedb7848297a9600b /wp-inst/wp-includes/functions-post.php
parenteb69639d667f0c15130e26e79e06fd6f891f3936 (diff)
downloadwordpress-mu-8a682722d1b64ba299997ff3f6099db353fab43a.tar.gz
wordpress-mu-8a682722d1b64ba299997ff3f6099db353fab43a.tar.xz
wordpress-mu-8a682722d1b64ba299997ff3f6099db353fab43a.zip
Merge from WP SVN.
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@27 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-inst/wp-includes/functions-post.php')
-rw-r--r--wp-inst/wp-includes/functions-post.php74
1 files changed, 2 insertions, 72 deletions
diff --git a/wp-inst/wp-includes/functions-post.php b/wp-inst/wp-includes/functions-post.php
index c078ffd..4912d24 100644
--- a/wp-inst/wp-includes/functions-post.php
+++ b/wp-inst/wp-includes/functions-post.php
@@ -381,77 +381,6 @@ function trackback_url_list($tb_list, $post_id) {
}
}
-
-// query user capabilities
-// rather simplistic. shall evolve with future permission system overhaul
-// $blog_id and $category_id are there for future usage
-
-/* returns true if $user_id can create a new post */
-function user_can_create_post($user_id, $blog_id = 1, $category_id = 'None') {
- $author_data = get_userdata($user_id);
- return ($author_data->user_level > 1);
-}
-
-/* returns true if $user_id can create a new post */
-function user_can_create_draft($user_id, $blog_id = 1, $category_id = 'None') {
- $author_data = get_userdata($user_id);
- return ($author_data->user_level >= 1);
-}
-
-/* returns true if $user_id can edit $post_id */
-function user_can_edit_post($user_id, $post_id, $blog_id = 1) {
- $author_data = get_userdata($user_id);
- $post = get_post($post_id);
- $post_author_data = get_userdata($post->post_author);
-
- if ( (($user_id == $post_author_data->ID) && !($post->post_status == 'publish' && $author_data->user_level < 2))
- || ($author_data->user_level > $post_author_data->user_level)
- || ($author_data->user_level >= 10) ) {
- return true;
- } else {
- return false;
- }
-}
-
-/* returns true if $user_id can delete $post_id */
-function user_can_delete_post($user_id, $post_id, $blog_id = 1) {
- // right now if one can edit, one can delete
- return user_can_edit_post($user_id, $post_id, $blog_id);
-}
-
-/* returns true if $user_id can set new posts' dates on $blog_id */
-function user_can_set_post_date($user_id, $blog_id = 1, $category_id = 'None') {
- $author_data = get_userdata($user_id);
- return (($author_data->user_level > 4) && user_can_create_post($user_id, $blog_id, $category_id));
-}
-
-/* returns true if $user_id can edit $post_id's date */
-function user_can_edit_post_date($user_id, $post_id, $blog_id = 1) {
- $author_data = get_userdata($user_id);
- return (($author_data->user_level > 4) && user_can_edit_post($user_id, $post_id, $blog_id));
-}
-
-/* returns true if $user_id can edit $post_id's comments */
-function user_can_edit_post_comments($user_id, $post_id, $blog_id = 1) {
- // right now if one can edit a post, one can edit comments made on it
- return user_can_edit_post($user_id, $post_id, $blog_id);
-}
-
-/* returns true if $user_id can delete $post_id's comments */
-function user_can_delete_post_comments($user_id, $post_id, $blog_id = 1) {
- // right now if one can edit comments, one can delete comments
- return user_can_edit_post_comments($user_id, $post_id, $blog_id);
-}
-
-function user_can_edit_user($user_id, $other_user) {
- $user = get_userdata($user_id);
- $other = get_userdata($other_user);
- if ( $user->user_level > $other->user_level || $user->user_level > 8 || $user->ID == $other->ID )
- return true;
- else
- return false;
-}
-
function wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_agent) {
global $wpdb;
@@ -532,6 +461,7 @@ function wp_new_comment( $commentdata, $spam = false ) {
if ( $user_id ) {
$userdata = get_userdata($user_id);
+ $user = new WP_User($user_id);
$post_author = $wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = '$comment_post_ID' LIMIT 1");
}
@@ -552,7 +482,7 @@ function wp_new_comment( $commentdata, $spam = false ) {
}
}
- if ( $userdata && ( $user_id == $post_author || $userdata->user_level >= 9 ) ) {
+ if ( $userdata && ( $user_id == $post_author || $user->has_cap('level_9') ) ) {
$approved = 1;
} else {
if ( check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $comment_type) )