From e7795c365acf331aaf2f902fe1f27e72ff15775c Mon Sep 17 00:00:00 2001 From: donncha Date: Tue, 13 Feb 2007 15:41:30 +0000 Subject: Added get_user_id_from_string() Make editing a blog much faster git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@884 7be80a69-a1ef-0310-a953-fb0f7c49ff36 --- wp-includes/wpmu-functions.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'wp-includes/wpmu-functions.php') diff --git a/wp-includes/wpmu-functions.php b/wp-includes/wpmu-functions.php index d81c36d..4afaecd 100644 --- a/wp-includes/wpmu-functions.php +++ b/wp-includes/wpmu-functions.php @@ -303,11 +303,12 @@ function add_blog_option( $id, $key, $value ) { } -function update_blog_option( $id, $key, $value ) { +function update_blog_option( $id, $key, $value, $refresh = true ) { switch_to_blog($id); $opt = update_option( $key, $value ); restore_current_blog(); - refresh_blog_details( $id ); + if( $refresh == true ) + refresh_blog_details( $id ); } function switch_to_blog( $new_blog ) { @@ -1392,4 +1393,17 @@ function get_current_site() { return $current_site; } +function get_user_id_from_string( $string ) { + global $wpdb; + if( is_email( $string ) ) { + $user_id = $wpdb->get_var( "SELECT ID FROM {$wpdb->users} WHERE user_email = '$string'" ); + } elseif ( is_numeric( $string ) ) { + $user_id = $string; + } else { + $user_id = $wpdb->get_var( "SELECT ID FROM {$wpdb->users} WHERE user_login = '$string'" ); + } + + return $user_id; +} + ?> -- cgit