Might try this module<br>I have never used it but it looks promising<br><br><a href="http://drupal.org/project/region_visibility">http://drupal.org/project/region_visibility</a><br><br><div class="gmail_quote">On Fri, Jul 17, 2009 at 2:56 PM, Steve Edwards <span dir="ltr"><<a href="mailto:killshot91@comcast.net">killshot91@comcast.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div bgcolor="#ffffff" text="#000000">
<font size="-1"><font face="Arial">What about using a preprocess
function in a module to unset the sidebar region variable if the
condition is met?<br><font color="#888888">
<br>
Steve<br>
</font></font></font><div><div></div><div class="h5"><br>
Khalid Baheyeldin wrote:
<blockquote type="cite"><br>
<br>
<div class="gmail_quote">On Fri, Jul 17, 2009 at 2:01 PM, Earnie Boyd
<span dir="ltr"><<a href="mailto:earnie@users.sourceforge.net" target="_blank">earnie@users.sourceforge.net</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>Quoting "Tomá? Fülöpp (<a href="http://vacilando.org" target="_blank">vacilando.org</a>)" <<a href="mailto:tomi@vacilando.org" target="_blank">tomi@vacilando.org</a>>:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
<br>
I cannot find a generic way how to disable a sidebar programmatically.<br>
<br>
In my module, if some conditions are met, I would like to make sure
that the<br>
whole sidebar (or any blocks in it) are not rendered at all, regardless
of<br>
the theme.<br>
<br>
Could somebody advise, please? Sorry if it's obvious..<br>
<br>
</blockquote>
<br>
</div>
I think you want to use hook_block()[1].<br>
<br>
[1] <a href="http://api.drupal.org/api/function/hook_block" target="_blank">http://api.drupal.org/api/function/hook_block</a><br>
<font color="#888888"></font></blockquote>
<div><br>
He is talking about the whole sidebar, hence a region, not a block.<br>
hook_block() will not help here.<br>
<br>
In the past we have done it by setting the visibility PHP code for each
block<br>
in a given region, and that would make the entire sidebar invisible if
the <br>
conditions are met. It is a pain if you have more than a few blocks in
that<br>
region (right side bar for example).<br>
<br>
You said you don't want it in the theme, but it would be a simple
change in<br>
page.tpl.php<br>
<br>
<?php if ($right): ?><br>
<?php if (<b>!custom_visibility_function</b>()) ?><br>
<div id="sidebar-right" class="sidebar"><br>
<?php print $right ?><br>
</div><br>
<?php endif; ?><br>
<?php endif; ?><br>
<br>
The other option is to use preprocess_block(). Perhaps something like
this in<br>
template.php<br>
<br>
<?php<br>
function phptemplate_preprocess_block(&$variables) {<br>
if ($variables['block']->region = 'right') {<br>
if (!custom_visibility_function()) {<br>
unset($variables['block'];<br>
}<br>
}<br>
}<br>
?><br>
<br>
Still in the theme though.<br>
</div>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><font color="#888888"><br>
<br>
--<br>
Earnie<br>
-- <a href="http://r-feed.com/" target="_blank">http://r-feed.com/</a>
-- <a href="http://for-my-kids.com/" target="_blank">http://for-my-kids.com/</a><br>
-- <a href="http://www.4offer.biz/" target="_blank">http://www.4offer.biz/</a> -- <a href="http://give-me-an-offer.com/" target="_blank">http://give-me-an-offer.com/</a><br>
<br>
</font></blockquote>
</div>
<br>
<br clear="all">
<br>
-- <br>
Khalid M. Baheyeldin<br>
<a href="http://2bits.com" target="_blank">2bits.com</a>, Inc.<br>
<a href="http://2bits.com" target="_blank">http://2bits.com</a><br>
Drupal optimization, development, customization and consulting.<br>
Simplicity is prerequisite for reliability. -- Edsger W.Dijkstra<br>
Simplicity is the ultimate sophistication. -- Leonardo da Vinci<br>
</blockquote>
</div></div></div>
</blockquote></div><br><br clear="all"><br>-- <br>Jim Taylor<br>Rooty Hollow LLC, Owner<br><a href="mailto:jim@rootyhollow.com">jim@rootyhollow.com</a><br><a href="http://www.rootyhollow.com">www.rootyhollow.com</a><br>(614) 432-8609<br>
<br>Twitter: jalama<br>Linkedin: <a href="http://www.linkedin.com/in/rootyhollow">http://www.linkedin.com/in/rootyhollow</a><br>