Okay.. I've been trying to make this feature for blocks - to have the ability to hide block by clicking specific link like <a class="ajaxwillupdateme" href="/hideblock/$module_name/$delta"></a> for global user. That link would work with ajax, so the user who clicked the link would have his settings updated about block visibility which you define in block config :
http://pokit.etf.ba/upload/pokit8576d5a526fe75112fee46cc3a77e927.png
I tried to make something.. but I don't know php well, so if anyone can help me to solve this.
The code looks like this :
<?php
/**
* Implementation of hook_menu().
*/
function hide_block_m_menu()
{
$items['hideblock/%/%'] = array(
'title' => t("Hide the clicked block and update settings "),
'page callback' => 'hide_block_func_ajax',
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
return $items;
}
// I used the variables below from block.module code which saves user when the settings are set and submitted
function hide_block_func_ajax($module_name, $delta) {
global $user;
if (isset($user->block[$module_name][$delta])) {
$user->block[$module_name][$delta] = FALSE;
}
user_save($user);
}
?>When I enabled the module and set the ajax options for link, and gave option hidelink/block/42 it responded 404 all the time, so it seems that I cant make this work.
The goal of this module is to make hiding of modules more practical, dynamic and less "user/%/edit settings" frustrating
Comments
Subscribing
Subscribing