Off-Canvas menus disappearing when logging out


Hi Thierry, I'm not sure if this is a fault with Beans but I can't figure out why this is happeing.

Further to the discussion we had regarding off-canvas menus (https://community.getbeans.io/discussion/off-canvas-menus/)

I have implemented a page with the two areas (left and right) allocated for vertical menus (displayed until screen width < 1150 and then off-canvas menus take over). All is fine when I am logged in. When I log out the menus disappear. The template is still being used. When I narrow the browser width to force the mobile menu to be displayed - the hamburger icon is displayed but does not function. I am not getting any Javascript errors.

Here is a link to the page. https://www.soccerlotto.com/premium/newhome/

Any suggestions?


Hey Steve,

Your off-canvas buttons are referring to off-canvas id primary_offcanvas and secondary_offcanvas but I can't see it anywhere in the HTML. What code do you use to add your off-canvas to the page?

Thanks,


Here's my code in functions.php:

add_action( 'widgets_init', 'beans_child_widget_areas' );

function beans_child_widget_areas() {

  beans_register_widget_area( array(
    'name' => 'Primary Off-canvas',
   'id' => 'primary_offcanvas',
    'beans_type' => 'offcanvas'
 ) );

  beans_register_widget_area( array(
    'name' => 'Secondary Off-canvas',
   'id' => 'secondary_offcanvas',
    'beans_type' => 'offcanvas'
 ) );

}

I'll send you login details so that you can see the page as it's meant to be. It's like the code above is not being actioned if the user is logged out (?) Apologies in advance if this is not related to Beans.


It looks like the 'asides' (my side menus) ar being pulled off the page (-66.6666%). When (using Firebug) I change it to 0 the menu is visible again (although in the wrong place).

I can't for the life of me see how this relates to being logged in or not.


Hey Steve,

Regarding your widget area, you have correctly registered it but you are not adding it to the page. Usually off-canvas widget area should be added at the bottom of the page, here is the code snippet to do so:

add_action( 'beans_site_after_markup', 'example_offcanvas_widget_area' );

function example_offcanvas_widget_area() {

 echo beans_widget_area( 'primary_offcanvas' );
  echo beans_widget_area( 'secondary_offcanvas' );

}

Regarding your sidebars issue, it seem like the main post content is different when you are logged in/out. When your are logged out, it seems (not 100% sure) like there is an HTML tag which is not closed properly causing problems. I will let you debugger that by testing plain and simple post content (without builder) to identify if the issue comes from that.

Thanks,


Hi Thierry, No go I'm afraid.

I have taken out the central page content and that has made no difference. Also, I already have the code you posted above in my template file....

<?php
/* Template Name: Homepage Template */

// Do all your page template modification here.
add_filter( 'beans_layout_grid_settings', 'example_modify_grid' );

function example_modify_grid( $args ) {
    return array_merge( $args, array(
        'grid' => 6,
        'primary_sidebar' => 2,
        'secondary_sidebar' => 2,
        'breakpoint' => 'medium' // medium is the default but you may change to breackpoint to small or large
    ) );

}

// Add off-canvas buttons before the main grid as an example.
add_action( 'beans_main_grid_before_markup', 'beans_child_view_offcanvas_buttons' );

function beans_child_view_offcanvas_buttons() {

    ?>
    <div class="uk-margin-bottom">
        <div class="uk-grid uk-grid-medium">
            <div class="uk-width-1-6 soccer-button"><a class="uk-button" id="soccer-menu" href="#primary_offcanvas" data-uk-offcanvas><i class="uk-icon-bars uk-margin-medium-right"></i> Soccer Stats</a></div>
            <div class="uk-width-4-6"><span id="ticker"><?php if(function_exists('ditty_news_ticker')){ditty_news_ticker(75);} ?></span></div>
            <div class="uk-width-1-6 lottery-button"><a class="uk-button" id="lottery-menu"  href="#secondary_offcanvas" data-uk-offcanvas><i class="uk-icon-bars uk-margin-medium-right"></i> Lottery Stats</a></div>
        </div>
    </div>
    <?php

}

// Add the off-canvas widget area afther the site closing markup.
add_action( 'beans_site_after_markup', 'beans_child_view_offcanvas' );

function beans_child_view_offcanvas() {

    echo beans_widget_area( 'primary_offcanvas' );
    echo beans_widget_area( 'secondary_offcanvas' );

}

// Add uk-offcanvas-bar-flip to the secondary off-canvas so that it opens from the right.
beans_add_attribute( 'beans_widget_area_offcanvas_bar[_secondary_offcanvas]', 'class', 'uk-offcanvas-bar-flip' );

beans_replace_attribute( 'beans_main_grid' , 'class', 'uk-grid', 'uk-grid uk-grid-collapse');

// Load the document which is always needed at the bottom of page templates.
beans_load_document();

Did you get the login details I sent you? As you can see the menus are fine when logged in. Damn strange.


I think it's best if I move this to a development server to rule out problems with plugins.

I'll do that and get back to you.


Hi Thierry, I have set up a development server and installed th template and PMPro (membership system). It appears to be working fine when I logout on that server. I have to conclude it is some sort of conflict with PMPro but I can't track it down.

If you do get as chance to have another look sometime it would be greatly appreciated. The dev server page url is: http://www.dallasdesign.uk/soccerlotto/ As you can see the menus are showing fine there when not logged in.

Thanks.


Bingo! Looks like I've tracked it down! It is a plugin. A widget to display the 'Recent Board Topics' from my PHPBB3 message board. Let me know if you're interested at all in investigating it. I'll have a look at it's code and get onto the author (I might send him/her an invoice!!!) πŸ™‚ Thanks for your help Thierry.


Hey Steve,

I am really glad to hear that you tracked down the issue. I'd love to have the time to look into the plugin causing issue but I have to prioritize where I can be the most helpful and make the most of my time, which is not spending time debugging other plugins developers' work πŸ˜‰

Have fun,


πŸ™‚ Yes, of course. I just meant in case you were interested in how that plugin managed to cause that issue. I assume that any messy HTML in a plugin will cause problems with any theme.

Thanks Thierry.

Write a reply

Login or register to write a reply, it's free!