Drupal: How to Disable (Hide) Block
This article will tell you how to disable (hide) block in a few methods: through block settings, PHP-snippet, SQL-snippet, etc.
Solutions:
- Disable block on block settings page
- Return to the previous page in browser history
- PHP-snippet
- SQL-snippet
- Change theme (design)
Disable block on block settings page
- Open ‘Blocks’ page in your browser (administer > Site building > Blocks)
- Select ‘No’ opposite the required block in Region column
- Save your changes
Return to the previous page in browser history
You can use this method with open browser window only.
If browser shows blank page or errors of PHP interpreter when block saving, click Back button. You will see the previous page.
Change block visibility or disable it. Then save changes again. Thus you can save your site in FireFox and Opera.
PHP-snippet
<?php
$block_title="Название блока";
$result=db_fetch_object(db_query("SELECT bid FROM {boxes} WHERE info=%s LIMIT 1", $block_title));
db_query("UPDATE {blocks} SET visibility=0 WHERE module=’block’ AND delta=%d LIMIT 1", $result->bid);
?>
SQL-snippet
Execute SQL-request:
SELECT * FROM boxes;
Find the required block and keep its bid in mind. Then execute SQL-request:
UPDATE blocks SET visibility=0 WHERE module=’block’ AND delta=bid LIMIT 1;
where bid – block identifier,
LIMIT 1 – number of strings to be processed
Change theme (design)
If this block wasn’t included to site theme by default, you can remove/rename folder with current theme and Drupal will switch to the default theme. Thus you can remove undesirable block.
Summary
I recommend you to use the next method if the previous method doesn’t fit.