diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-10-16 13:06:02 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-10-16 13:06:02 +0000 |
commit | 35fa0c742a676868205bdc760d0f4427d525ae1a (patch) | |
tree | b7ec52c0174442270c3f7f21e0be6fa3a644f1f7 /wp-includes | |
parent | 22c5a6f185aafff9267ce16db4e890f9f453aa61 (diff) | |
download | wordpress-mu-35fa0c742a676868205bdc760d0f4427d525ae1a.tar.gz wordpress-mu-35fa0c742a676868205bdc760d0f4427d525ae1a.tar.xz wordpress-mu-35fa0c742a676868205bdc760d0f4427d525ae1a.zip |
Added update_user_status(), refresh_user_status()
Make redirect safer
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1079 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes')
-rw-r--r-- | wp-includes/wpmu-functions.php | 45 |
1 files changed, 40 insertions, 5 deletions
diff --git a/wp-includes/wpmu-functions.php b/wp-includes/wpmu-functions.php index dc1b7cc..c4f8849 100644 --- a/wp-includes/wpmu-functions.php +++ b/wp-includes/wpmu-functions.php @@ -560,6 +560,36 @@ function update_archived( $id, $archived ) { return $archived; } +function update_user_status( $id, $pref, $value, $refresh = 1 ) { + global $wpdb; + + $wpdb->query( "UPDATE {$wpdb->users} SET {$pref} = '{$value}' WHERE ID = '$id'" ); + + if( $refresh == 1 ) + refresh_user_details($id); + + if( $pref == 'spam' ) { + if( $value == 1 ) + do_action( "make_spam_user", $id ); + else + do_action( "make_ham_user", $id ); + } + + return $value; +} + +function refresh_user_details($id) { + global $wpdb, $wpmuBaseTablePrefix; + + if ( !$user = get_userdata( $id ) ) + return false; + + wp_cache_delete($id, 'users'); + wp_cache_delete($user->user_login, 'userlogins'); + + return $id; +} + function update_blog_status( $id, $pref, $value, $refresh = 1 ) { global $wpdb; @@ -815,10 +845,15 @@ function get_blog_permalink( $blog_id, $post_id ) { // wpmu admin functions function wpmu_admin_do_redirect( $url = '' ) { - if( $_REQUEST[ 'ref' ] ) { - $ref = $_REQUEST[ 'ref' ]; - $ref = wpmu_admin_redirect_add_updated_param( $_REQUEST[ 'ref' ] ); - header( "Location: {$ref}" ); + $ref = ''; + if ( isset( $_GET['ref'] ) ) + $ref = $_GET['ref']; + if ( isset( $_POST['ref'] ) ) + $ref = $_POST['ref']; + + if( $ref ) { + $ref = wpmu_admin_redirect_add_updated_param( $ref ); + wp_redirect( $ref ); die(); } if( empty( $_SERVER[ 'HTTP_REFERER' ] ) == false ) { @@ -834,7 +869,7 @@ function wpmu_admin_do_redirect( $url = '' ) { } elseif( isset( $_POST[ 'redirect' ] ) ) { $url = wpmu_admin_redirect_add_updated_param( $_POST[ 'redirect' ] ); } - header( "Location: {$url}" ); + wp_redirect( $url ); die(); } function wpmu_admin_redirect_add_updated_param( $url = '' ) { |