I am using a subtheme based on Genesis, with a left sidebar.

The primary and secondary menus are turned on in the theme settings page.

They appear in the left sidebar for an authenticated user but not an anonymous user.

The left sidebar is not present for an anonymous user.
If something else is present in the left side-bar, both menus are present as well as whatever I turned on.

Since the menus are present when some other item is added to the left sidebar I assume it is not a permissions problem.

I have added a login block to the sidebar, which gives me the menus for anonymous users - but this feels like a temporary solution: something else must be wrong to make them invisible when they are the only items in the sidebar.

Here's a page, with menus showing as I have the login block enabled:
http://shaun.utopia.co.nz/~catalyst/cultural-diversity

Any clues where to look for a solution?

Comments

Jeff Burnz’s picture

All regions are wrapped in conditional statements, like this:

      <?php if ($left): // this is the conditional wrapper ?>
        <div id="sidebar-left" class="section sidebar region"><div class="sidebar-inner">
          <?php print $left; ?>
        </div></div> <!-- /sidebar-left -->
      <?php endif; ?>

This is so a region will ONLY appear if a BLOCK is active in that region. This is how all good themes are built, so regions collapse (don't appear) when they are not being used.

Theres two solutions here for you:

1. Use the Primary and Secondary links BLOCKS, rather than moving the code around in page.tpl.php (Recommended and easiest solution, this is the default way things should be done).

2. Remove the conditional wrapper from the left sidebar - however, the layout will break because the layout relies on BODY CLASSES being added which are only added when there are BLOCKS active in this or that region.

belong@mywebworkshop.com’s picture

HI Jeff,
thanks for your quick response.

Are you saying that the presence of primary and secondary menus in the sidebar are not enough to tell $left to put in a sidebar?
There has to be block?

I guess it works for authenticated users because there is the navigation in the sidebar.

This feels like the sort of variation that should be in the documentation - or perhaps I missed it. (Suggested documentation: "Turn off primary and secondary menus in the theme settings page and use blocks to place menus, unless a region has another block in it to trigger the region's inclusion on the page.")

Cheers
Miriam

Jeff Burnz’s picture

Sounds like a good docs page, I see where your confusion is coming from - just another small wtf moment from Drupal :)

belong@mywebworkshop.com’s picture

Status: Active » Closed (fixed)

I modified the php (first time messing with the php and it worked!) so it shows the sidebar if there is a primary or secondary menu or a block.

if ($left or $primary_menu or $secondary_menu):

Screenack’s picture

Status: Closed (fixed) » Active

Using: drupal 6.20; Genesis 6.x-2.4; the only non-core module enabled: admin-menu

I see this issue is closed, however, I am experiencing something quite similar.

I have primary links and secondary links. The secondary links use primary links as their source, and the node tree is properly populated. Since the base theme's nav id shows either if populated, I see the secondary links as per the theme's default.

Here's the rub. If I dont want the secondary menus in the nav id but in the sidebar left element, I must first remove that from the page.tpl.php (no big deal) BUT, if I then, using the Secondary Links block, move/assign it to the sidebar left region via the Blocks screen, nothing shows. I can force it to show by adding a different block element, which enables the conditional php check, I suppose.

It seems that adding the secondary links block, alone, fails to trigger the required logical condition? (Contra your suggestions, item #1)

My fix for now is the following modification to page.tpl.php:

<?php if ($left or $secondary_menu): ?>
	<div id="sidebar-left" class="section sidebar region">
	  <?php if ($left): print $left; endif; ?>
	  <?php if ($secondary_menu): ?>
	    <div id="sidebar-left-nav" class="clear-block">
	      <?php if ($secondary_menu): print $secondary_menu; endif; ?>
	    </div> <!-- /sidebar left nav -->
	  <?php endif; ?>
	</div> <!-- /sidebar-left -->
<?php endif; ?>

But I'd really rather use the process you've outlined, however.

I love the genesis theme; thanks for your excellent contribution!

Update: I rejiggered the primary and secondary menu configuration. Whereas, when I created this post, secondary menus were the second tier. Now, I've made them independent, i.e., their own source and the block works. I'm guessing that sourcing primary menu on secondary causes the issue?

Jeff Burnz’s picture

"I'm guessing that sourcing primary menu on secondary causes the issue"

Yes I assume so, fyi I always use the Menu Block module these days and never use Drupals automagical primary/secondary linking feature, mainly because I only want to deal with blocks and not these hard coded variables in the templates.

Screenack’s picture

Status: Active » Closed (fixed)