Add temporary cap/roles updater. Define RESET_CAPS to enable.
git-svn-id: http://svn.automattic.com/wordpress/trunk@2722 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8226fb2239
commit
44644cbb6c
|
@ -254,6 +254,14 @@ function upgrade_160() {
|
|||
$id = $wpdb->escape( $id );
|
||||
$wpdb->query("UPDATE $wpdb->users SET display_name = '$id' WHERE ID = '$user->ID'");
|
||||
endif;
|
||||
|
||||
// FIXME: Temporary code to reset roles and caps if flag is set.
|
||||
if ( defined('RESET_CAPS') ) {
|
||||
$level = get_usermeta($user->ID, $table_prefix . 'user_level');
|
||||
$role = translate_level_to_role($level);
|
||||
update_usermeta( $user->ID, $table_prefix . 'capabilities', array($role => true) );
|
||||
}
|
||||
|
||||
endforeach;
|
||||
$old_user_fields = array( 'user_firstname', 'user_lastname', 'user_icq', 'user_aim', 'user_msn', 'user_yim', 'user_idmode', 'user_ip', 'user_domain', 'user_browser', 'user_description', 'user_nickname', 'user_level' );
|
||||
$wpdb->hide_errors();
|
||||
|
|
|
@ -324,7 +324,10 @@ function populate_roles() {
|
|||
array('name' => __('Inactive'),
|
||||
'capabilities' => array())
|
||||
);
|
||||
|
||||
// FIXME: Temporary code to reset roles and caps if flag is set.
|
||||
if ( defined('RESET_CAPS') )
|
||||
update_option($table_prefix . 'user_roles', $roles);
|
||||
else
|
||||
add_option($table_prefix . 'user_roles', $roles);
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue