WordPress.org

WordPress MU

Changeset 1590


Ignore:
Timestamp:
01/15/09 12:59:00 (5 years ago)
Author:
donncha
Message:

If no role in current blog, then use "contributor" and delete it afterwards.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/user-edit.php

    r1573 r1590  
    144144 
    145145$cap = $wpdb->get_var( "SELECT meta_value FROM {$wpdb->usermeta} WHERE user_id = '{$user_id}' AND meta_key = '{$wpdb->base_prefix}{$wpdb->blogid}_capabilities' AND meta_value = 'a:0:{}'" ); 
     146$delete_role = false; 
     147if( $null == $cap && $_POST[ 'role' ] == '' ) { 
     148    $_POST[ 'role' ] = 'contributor'; 
     149    $delete_role = true; 
     150} 
    146151$errors = edit_user($user_id); 
    147 if( $cap == null ) // stops users being added to current blog when they are edited 
    148     $wpdb->query( "DELETE FROM {$wpdb->usermeta} WHERE user_id = '{$user_id}' AND meta_key = '{$wpdb->base_prefix}{$wpdb->blogid}_capabilities' AND meta_value = 'a:0:{}'" ); 
     152if( $delete_role ) // stops users being added to current blog when they are edited 
     153    update_usermeta( $user_id, $wpdb->base_prefix . $wpdb->blogid . '_capabilities' , '' ); 
    149154 
    150155if ( !is_wp_error( $errors ) ) { 
Note: See TracChangeset for help on using the changeset viewer.