Use API instead of bare SQL queries in site-users.php.
see #21767 git-svn-id: http://core.svn.wordpress.org/trunk@23974 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
375cb66409
commit
003941b2e7
|
@ -85,12 +85,10 @@ if ( $action ) {
|
||||||
if ( !empty( $_POST['newuser'] ) ) {
|
if ( !empty( $_POST['newuser'] ) ) {
|
||||||
$update = 'adduser';
|
$update = 'adduser';
|
||||||
$newuser = $_POST['newuser'];
|
$newuser = $_POST['newuser'];
|
||||||
$userid = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM " . $wpdb->users . " WHERE user_login = %s", $newuser ) );
|
$user = get_user_by( 'login', $newuser );
|
||||||
if ( $userid ) {
|
if ( $user->exists() ) {
|
||||||
$blog_prefix = $wpdb->get_blog_prefix( $id );
|
if ( ! is_user_member_of_blog( $user->ID, $id ) )
|
||||||
$user = $wpdb->get_var( "SELECT user_id FROM " . $wpdb->usermeta . " WHERE user_id='$userid' AND meta_key='{$blog_prefix}capabilities'" );
|
add_user_to_blog( $id, $user->ID, $_POST['new_role'] );
|
||||||
if ( $user == false )
|
|
||||||
add_user_to_blog( $id, $userid, $_POST['new_role'] );
|
|
||||||
else
|
else
|
||||||
$update = 'err_add_member';
|
$update = 'err_add_member';
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue