Commit d8519994 authored by drumm's avatar drumm

#157652 by beginner, Steven Merrill and killes: block_user() had a global user...

#157652 by beginner, Steven Merrill and killes: block_user() had a global user object and a user parameter colliding
parent dd4d3d9e
......@@ -589,12 +589,11 @@ function block_box_save($edit, $delta = NULL) {
* Allow users to decide which custom blocks to display when they visit
* the site.
*/
function block_user($type, $edit, &$user, $category = NULL) {
global $user;
function block_user($type, $edit, &$account, $category = NULL) {
switch ($type) {
case 'form':
if ($category == 'account') {
$rids = array_keys($user->roles);
$rids = array_keys($account->roles);
$placeholders = implode(',', array_fill(0, count($rids), '%d'));
$result = db_query("SELECT DISTINCT b.* FROM {blocks} b LEFT JOIN {blocks_roles} r ON b.module = r.module AND b.delta = r.delta WHERE b.status = 1 AND b.custom != 0 AND (r.rid IN ($placeholders) OR r.rid IS NULL) ORDER BY b.weight, b.module", $rids);
$form['block'] = array('#type' => 'fieldset', '#title' => t('Block configuration'), '#weight' => 3, '#collapsible' => TRUE, '#tree' => TRUE);
......@@ -602,7 +601,7 @@ function block_user($type, $edit, &$user, $category = NULL) {
$data = module_invoke($block->module, 'block', 'list');
if ($data[$block->delta]['info']) {
$return = TRUE;
$form['block'][$block->module][$block->delta] = array('#type' => 'checkbox', '#title' => check_plain($data[$block->delta]['info']), '#default_value' => isset($user->block[$block->module][$block->delta]) ? $user->block[$block->module][$block->delta] : ($block->custom == 1));
$form['block'][$block->module][$block->delta] = array('#type' => 'checkbox', '#title' => check_plain($data[$block->delta]['info']), '#default_value' => isset($account->block[$block->module][$block->delta]) ? $account->block[$block->module][$block->delta] : ($block->custom == 1));
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment