I'm trying to create a block that comes with a drupal module. I can't get it to show up in my block list. I tried a lof of different tutorials, even just copy paste and it still doesn't show up. Could it be anything in my drupal settings that stops my modules block from showing up? Or is there anything wrong in the code?
The module shows and is activated.
This is my code right now:
helicopter_contest_form.info I'm trying to create a block that comes with a drupal module. I can't get it to show up in my block list. I tried a lof of different tutorials, even just copy paste and it still doesn't show up. Could it be anything in my drupal settings that stops my modules block from showing up? Or is there anything wrong in the code?
The module shows and is activated.
This is my code right now:
helicopter_contest_form.info
;$Id$ name = Helicopter contest form description = Block module with a contest form core = 7.x package = My modules files[] = helicopter_contest_form.module
helicopter_contest_form.module
/**
* Implements hook_block_info().
*/
function membercount_block_info() {
$blocks = array ();
$blocks['count_members'] = array (
'info' => t('Count Members'),
'cache' => DRUPAL_NO_CACHE,
);
return $blocks;
}
/**
* Implements hook_block_view().
*/
function membercount_block_view($name) {
if ($name == 'count_members') {
$count = db_query('SELECT COUNT(uid) - 1 FROM {users}')->fetchField();
$content = format_plural($count, 'This site has 1 user.', 'This site has @count users.');
$block = array (
'subject' => t('Members'),
'content' => $content,
);
return $block;
}
}
On a sidenote, how do I indent all my code 4 spaces at once? I have to do it each row by hand, it also ruins my indenting...