I have a module that I've activated, but it does not show up in the disabled blocks list.

The module is named "My Module." Inside the my_module folder I have the following files:

  • my_module.module
  • my_module.info


name = My Module
description = My module description.
core = 6.x
package = My Modules


function hook_block($op = 'list', $delta = 0, $edit = array()){
  switch ($op) {
    case 'list':
      $block = array();
      //List out all blocks you want to create here
      $block[0]["info"] = t('Display info'); 
    case 'view':    
      switch ($delta) {
        case 0:
          global $user;
          $block['subject'] = "ADMIN Header of the block";

          if (in_array('Site admin', array_values($user->roles) || $user->uid == 1)) {
            $block['content'] = "input form";
            $block['subject'] = "Header of the block";

Change function hook_block to function my_module_block, and add return $block; to the end of the 'list' and 'view' cases.

  • Thank you! Also had to add return $block; to the list case for it to show up. – kylex Sep 9 '11 at 15:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.