1

I have the following code but its not disbling the block. It remains active and visible on the sidebar where i have placed it.

$theme="themename";
$block="client-block-1938";
$module="modulename";
$region="right_top_box";
db_merge('block')
        ->key(array('theme' => $theme, 'delta' => $block, 'module' => $module))
        ->fields(
                       array(
                              'region' => $region,
                              'status' => 0,
                              'visibility' => 0,
                           )
             )
->execute();
cache_clear_all();

2 Answers 2

1

Use db_update.

db_update('block')
   ->fields(array(
     'status' => 0,
     'weight' => -10,
     'region' => 'disabled',
   ))
   ->condition('module', 'modulename')
   ->condition('delta', 'modulename_delta')
   ->execute();
0

I think this should work.

     db_update('block')
        ->fields(array(
          'status' => 0,
          'weight' => -10,
          'region' => 'disabled',
        ))
     ->condition('module', $module)
     ->condition('delta', $delta)
     ->condition('theme', $theme)     
      ->execute();

    cache_clear_all();
1
  • I have done the above but the block remains visible. I checked in the database and all the above updates where applied. No more help please?
    – ibexy
    Commented Sep 28, 2016 at 13:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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