function bb_upgrade_160() { if (($dbv = bb_get_option_from_db('bb_db_version')) && $dbv >= 535) { return; } require_once BB_PATH . 'bb-admin/includes/functions.bb-admin.php'; $blocked = bb_get_ids_by_role('blocked'); foreach ($blocked as $b) { bb_break_password($b); } return 'Done reversibly breaking passwords: ' . __FUNCTION__; }
// Add user meta data foreach ($profile_info_keys as $key => $label) { if ('display_name' == $key || 'ID' == $key || strpos($key, 'user_') === 0) { continue; } if (${$key} != '' || isset($user->{$key})) { bb_update_usermeta($user->ID, $key, ${$key}); } } } if (bb_current_user_can('edit_users')) { if (!array_key_exists($role, $user->capabilities)) { $user_obj->set_role($role); // Only support one role for now if ('blocked' == $role && 'blocked' != $old_role) { bb_break_password($user->ID); } elseif ('blocked' != $role && array_key_exists('blocked', $user->capabilities)) { bb_fix_password($user->ID); } } foreach ($profile_admin_keys as $key => $label) { if (${$key} != '' || isset($user->{$key})) { bb_update_usermeta($user->ID, $key, ${$key}); } } foreach ($assignable_caps as $cap => $label) { if (!($already = array_key_exists($cap, $user->capabilities)) && ${$cap}) { $user_obj->add_cap($cap); } elseif (!${$cap} && $already) { $user_obj->remove_cap($cap); }