function homebox_update_6001 in Homebox 6.3
Same name and namespace in other branches
- 6 homebox.install \homebox_update_6001()
- 6.2 homebox.install \homebox_update_6001()
Use 'custom' delta for homebox blocks.
File
- ./
homebox.install, line 67 - The install file for Homebox allows the module to install (and uninstall) itself. This is required as this module uses its own table.
Code
function homebox_update_6001() {
$return = array();
$result = db_query("SELECT uid, name, settings FROM {homebox_users}");
while ($row = db_fetch_object($result)) {
$row->settings = unserialize($row->settings);
foreach ($row->settings as $key => $block) {
if (isset($block['module']) && $block['module'] === 'homebox') {
// Save the new key for later.
$new_key = 'homebox_custom-' . $block['delta'];
// Set delta to standard.
$block['delta'] = 'custom';
// Move title.
$block['title_custom'] = $block['title'];
$block['title'] = '';
// Move block to new key.
unset($row->settings[$key]);
$row->settings[$new_key] = $block;
}
}
drupal_write_record('homebox_users', $row, array(
'uid',
'name',
));
}
return $return;
}