Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #230991

    I’m using DigitalAccessPass (DAP) in conjunction with WordPress to manage the frontend of my site. DAP hides/removes pages that are for “members eyes only” from the menu. This way these pages only appear in the menu if the user is logged into DAP.

    I understand that this may be a bit outside of the area of support for a purchased theme, but I have a support ticket in with the creators of DAP and I’m trying to work at this problem “from both ends” so to speak, because I’m kind of in a “limbo” area…plugin support for a theme.

    What is happening is my entire menu disappears from view when I activate the “hide members only pages” within DAP…but the actual links themselves are there if you mouseover the menu area (but there is no anchor text for any menu item, so you can’t see any menu). If I deactivate the “hide members only pages” within DAP, the menu appears 100% normally.

    Here is the only thing I can think of that might help you guys if you’re kind enough to have a look..the “before and after” source code of my menu with the “hide members only pages” within DAP setting activated (from <nav to </nav> with the two different sets of settings):

    EDIT: Please note I haven’t modified/beautified the source code…it’s a complete copy/paste…all the spacing changes, etc, are all a result of activating/deactiving the “hide members only pages” within DAP

    Here is my menu’s source code with “hide members only pages” setting activated within DAP – http://pastebin.com/raw.php?i=FHfj7T6Q – Note there is no anchor text for any of my menu items, but all of the appropriate links are there if you mouseover the menu area, but you can’t see any menu items at all.

    Here is my menu’s source code with “hide members only pages” setting deactivated within DAP – http://pastebin.com/raw.php?i=67qVKqUi – Note that my menu appears correctly, but all of the protected pages that I don’t want to appear in my menu are visible (because I have that setting set to “Yes”, but I need it set to no)

    • This topic was modified 10 years, 10 months ago by crazyflx.
    #231043

    Hey crazyflx!

    The only possible conflict I can think of is the wordpress menu walker class. Afaik wordpress doesn’t support multiple menu walkers for a menu and if our theme registers a menu walker class the membership plugin must not register a second walker class. However if it registers a second/custom walker class the menu might break. Our menu walker class can be found in wp-content\themes\enfold\includes\helper-responsive-megamenu.php and it’s required to display the mega menu. I’m not sure how the DigitalAccessPass plugin handles the menu and I don’t have enough time to dig into the plugin code but that’s imo the only possible conflict. If you just need a function which hides/shows certain menu items based on the user roles try the “conditional menu” feature: https://kriesi.at/support/topic/enfold-conditional-menu/ . If you want to add a custom conditional check see: https://kriesi.at/support/topic/using-conditional-menus-with-custom-defined-user-roles/ for more information.

    Regards,
    Peter

    #231096

    Hello Dude,

    I, again, appreciate the help. Getting over this last hiccup will be the last thing I need help with as my site will be complete.

    I checked your two provided links, and while they don’t completely solve my issue, they did help…indirectly. I’m thinking I can use enfolds conditional menu check (which I’ve successfully enabled) with DAP’s “is logged in?” check. I just need to hide menu items if the user is not logged into DAP (regardless of whether or not they’re logged into/out of wordpress).

    DAP uses the following check to check whether a user is logged into/out of DAP:

    if( !Dap_Session::isLoggedIn() ) {
    //DO SOMETHING FOR USERS NOT LOGGED INTO DAP
    }
    else {
    //DO SOMETHING FOR USERS LOGGED INTO DAP
    }

    Now that I’ve enabled the conditional menu functionality within Enfold, I see that one of the conditional options is “hide/show if user is logged into/out of WP”

    Is there any way to use the DAP logged in/logged out check instead of the wordpress logged in/logged out check?

    • This reply was modified 10 years, 10 months ago by crazyflx.
    #232162

    Hi!

    You could add a new check with this code (insert it at the bottom of functions.php

    
    function avia_condition_dap(){
            if(Dap_Session::isLoggedIn()) return true;
            return false;
    }
    
    add_filter('avf_avia_menu_conditions','avia_add_conditional_options', 10,1);
    function avia_add_conditional_options($options){
    $options['avia_condition_dap'] = array('title' =>__('User Logged in (Dap)', 'avia_framework'));
    return $options;
    }
    

    This function will check if the user is logged in and if yes it will return true. Use the “User Logged in (Dap)” conditional option to check if the user is logged in or not.

    Best regards,
    Peter

    #234343

    I’ve got to say, the support here is stellar. Far better than from other places I’ve purchased themes/theme memberships from, thanks so much! I’ll be putting up a review about your theme/support on blackhatworld as my way of saying thanks.

    I do have one last question though…I tried putting the above logic into my functions.php file, and it broke the theme (the entire site just was white space). To resolve it, I had to download the functions.php file from wp-content/themes/enfold/functions.php via FTP, remove the added code and reupload it.

    I have no child themes installed, it’s just the activated Enfold theme from within the Enfold folder under wp-content/themes/enfold. Here is what my functions.php file looked like after I added the above code (which I had to remove because it broke it). This is from line 1 (and everything beneath what I’ve pasted here, is exactly as it comes with a fresh install of the theme…nothing added or modified):

    <?php
    global $avia_config;
    /*
    
     * if you run a child theme and dont want to load the default functions.php file
    
     * set the global var bellow in you childthemes function.php to true:
    
     *
    
     * example: global $avia_config; $avia_config['use_child_theme_functions_only'] = true;
    
     * The default functions.php file will then no longer be loaded. You need to make sure then
    
     * to include framework and functions that you want to use by yourself. 
    
     *
    
     * This is only recommended for advanced users
    
     */
    
     
    /* enable custom DAP hide/show menu logic */
    
    if(isset($avia_config['use_child_theme_functions_only'])) return;
    add_theme_support('avia_conditionals_for_mega_menu');
    
    if(!function_exists('avia_condition_customrole'))
    
    {
    
        function avia_condition_dap()
    
        {
    
            if(Dap_Session::isLoggedIn()) return true;
    
            return false;
    
        }
    
    }
    
    add_filter('avf_avia_menu_conditions','avia_add_conditional_options', 10,1);
    
    function avia_add_conditional_options($options){
    
    $options['avia_condition_dap'] = array('title' =>__('User Logged in (Dap)', 'avia_framework')),
    
    return $options;
    
    }
    /* end conditional menu logic addition */
    #234952

    Just a friendly bump :)

    #235373

    Hi!

    I noticed a small syntax error in my code. I updated it here: https://kriesi.at/support/topic/entire-menu-disappearing-instead-of-select-items-with-membership-plugin/#post-232162

    Please insert it at the very bottom of functions.php and make sure no other theme code is affected by the custom code (i.e. do not overwrite existing code).

    Regards,
    Peter

    #236142

    Hello Peter,

    You sir, are the man!

    That works beautifully…100% perfect working solution.

    I sincerely appreciate the excellent top notch support provided, especially for something so far from being a “theme issue”.

    You guys have earned my business for life and I’ll be singing your praises anywhere anybody will listen.

    #236197

    Hey!

    Great, glad I could help you :)

    Best regards,
    Peter

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Entire Menu Disappearing (Instead of Select Items) with Membership Plugin’ is closed to new replies.