Drupal: .htaccess Access Deny
August 21, 2014 – 7:59 am | No Comment

In this article I will tell how to forbid access to certain resources for some clients. The instructions will include descriptions of different directives.

Read the full story »
CSS Templates

Contain reviews and news about CSS Templates.

Freebies

Contain freebies such as icons, graphics, headers and images for your websites.

Fun Stuff

Contains other fun stuff for entertainment or interesting site showcase.

How-To

Contain technical elaborations on some specific workarounds or common tweak.

Joomla Templates

Contains reviews and news about Joomla templates.

Home » How-To

Drupal: How to Disable (Hide) Block

Submitted by on June 16, 2010 – 6:48 amNo Comment

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

Run PHP code on site:

<?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.

Leave a comment!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.