Hi
I am desperate for figure this out, its really the last thing I need to finish off my Drupal site. I am using 4.7-beta4 and I want a status bar for users. The information for the bar should be loaded into $user. The API suggests that
this is possible but using the hook _user.
I have tried this numerous ways and I can get any information I add to $user to be persistent. I have posted about this a number of times including 46551 and 46414. I realise that it seems to work for everyone so could some please please
point out what I am doing wrong in this example where I try to add a string to $user and display it in a block:
<?php
function block_example_help($section) {
switch ($section) {
case 'admin/modules#description':
// This description is shown in the listing at admin/modules.
return t('An example module showing how to define a block.');
}
}
function block_example_block($op = 'list', $delta = 0, $edit = array()) {
switch ($op) {
case 'list':
$blocks[0]['info'] = t('Example: configurable text string');
return $blocks;
case 'configure':
$form = array();
if ($delta == 0) {
$form['block_example_string'] = array(
'#type' => 'textfield',
'#title' => t('Block contents'),
'#size' => 60,
'#description' => t('This string will appear in the example block.'),
'#default_value' =>
variable_get('block_example_string', t('Some example content.')),
);
}
return $form;
case 'save':
if ($delta == 0) {
variable_set('block_example_string', $edit['block_example_string']);
}
return;
case 'view': default:
switch ($delta) {
case 0:
$block['subject'] = t('Title of block #1');
$block['content'] = block_example_contents(1);
break;
}
return $block;
}
}
function block_example_contents($which_block) {
global $user;
if ($which_block == 1) {
$output = variable_get('block_example_string', t('A default value.'));
$output .="