I am using Drupal 6.27, created my own module, used hook_perm() in my module. Now the question is - did i do that in the right way?
/**
* Implementation of hook_block().
*/
function adminka_block($op = 'list', $delta = 0, $edit = array()) {
switch($op) {
case 'list':
return array(
'adminka_simple_block' => array('info' => 'adminka simple block', 'cache' => BLOCK_NO_CACHE),
);
case 'view':
switch($delta) {
case 0:
if (user_access('view adminka')) {
$block['subject'] = t('My admin panel');
$block['content'] = '<a href="/node/add/' . variable_get('content_type', false) . '">Добавить ' . variable_get('content_type_name', false) . '</a><br />';
$block['content'] .= '<a href="/logout">Выход</a>';
break;
}
}
return $block;
}
}
Because i didn't found another way to restrict that block visiblity only to users with user_acess('view adminka').