WordPress.org

Make WordPress Core


Ignore:
Timestamp:
01/14/2010 02:02:19 AM (11 years ago)
Author:
wpmuguru
Message:

merge wp-admin user, plugins, themes, upgrade , See #11644

Location:
trunk/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin

    • Property svn:ignore set to
      .themes.php.swp
      .user-edit.php.swp
      .user-new.php.swp
      .users.php.swp
  • trunk/wp-admin/user-edit.php

    r12546 r12722  
    6161}
    6262
     63
     64// Only allow site admins to edit every user.
     65if ( is_multisite() && !defined( "EDIT_ANY_USER" ) && !is_super_admin() && $user_id != $current_user->ID )
     66    wp_die( __( 'You do not have permission to edit this user.' ) );
     67   
    6368switch ($action) {
    6469case 'switchposts':
     
    8287    do_action('edit_user_profile_update', $user_id);
    8388
    84 $errors = edit_user($user_id);
     89if ( !is_multisite() ) {
     90    $errors = edit_user($user_id);
     91} else {
     92    // WPMU must delete the user from the current blog if WP added him after editing.
     93    $delete_role = false;
     94    $blog_prefix = $wpdb->get_blog_prefix();
     95    if( $user_id != $current_user->ID ) {
     96        $cap = $wpdb->get_var( "SELECT meta_value FROM {$wpdb->usermeta} WHERE user_id = '{$user_id}' AND meta_key = '{$blog_prefix}capabilities' AND meta_value = 'a:0:{}'" );
     97        if( null == $cap && $_POST[ 'role' ] == '' ) {
     98            $_POST[ 'role' ] = 'contributor';
     99            $delete_role = true;
     100        }
     101    }
     102    if ( !isset( $errors ) || ( isset( $errors ) && is_object( $errors ) && false == $errors->get_error_codes() ) )
     103        $errors = edit_user($user_id);
     104    if( $delete_role ) // stops users being added to current blog when they are edited
     105        update_usermeta( $user_id, $blog_prefix . 'capabilities' , '' );
     106}
    85107
    86108if ( !is_wp_error( $errors ) ) {
Note: See TracChangeset for help on using the changeset viewer.