Template with Member Only Sidebars

Community Forums Forums Design Tips and Tricks Template with Member Only Sidebars

This topic is: not resolved

This topic contains 9 replies, has 3 voices, and was last updated by  anitac 8 months, 3 weeks ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #67651

    anitac
    Participant
    Post count: 6991

    I have a dilemma on my hands. I am using the WP-Members plugin with the Magazine theme, along with the Genesis Simple Sidebars. We’ve created custom menu items and attached them to the Member Only Sidebar (Primary) and Member Only 2 Sidebar (Secondary Sidebar). The content of the menu items is Member Only Pages. When I click the Member Only tab on the Navigation – the content area say, “You must be a member to view this content. Please log in or Register.” However – both of the Member Only sidebars are visible.

    Is there a way to create a template with Member Only sidebars where they will not show up at all until the member logs in or register?


    Let me help you customize your theme, responsive header, Buddypress, Agentpress or technical issue!
    Visit me here: Cre8tiveDiva.com | Tweet Me! | Plus Me!
    When asking for help, please provide a link or screen shot showing your problem!

    • This topic was modified 9 months, 1 week ago by  anitac.
    • This topic was modified 9 months, 1 week ago by  anitac.
    #67657

    braddalton
    Participant
    Post count: 8804

    1. Why don’t you add conditional tags to the widgets housing the custom menu’s so they only display for logged in members?

    You can use a a plugin Widget Logic or Slim Jetpack.

    2. Another option is to create a new widget area using conditional tags for logged-in and logged out users.

    3. Or you can conditionally remove the primary or secondary nav menu for logged out users.

    4. Or you can conditionally display any menu for logged in or logged out users.


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #67658

    anitac
    Participant
    Post count: 6991

    …..or, or, or…. I can email you!!! LOL! I am NOT that SMART Brad!!! I’ll try Widget Logic but 3 or 4 would work perfectly!


    Let me help you customize your theme, responsive header, Buddypress, Agentpress or technical issue!
    Visit me here: Cre8tiveDiva.com | Tweet Me! | Plus Me!
    When asking for help, please provide a link or screen shot showing your problem!

    #67675

    Sridhar Katakam
    Participant
    Post count: 923

    Add the following code in functions.php. Study it and make changes as needed.

    //* Register Members only Primary and Secondary sidebars
    
    genesis_register_sidebar( array(
    	'id'          => 'members-primary',
    	'name'        => __( 'Primary Sidebar (Members)', 'metro' ),
    	'description' => __( 'This is the members only primary sidebar.', 'metro' ),
    ) );
    
    genesis_register_sidebar( array(
    	'id'          => 'members-secondary',
    	'name'        => __( 'Secondary Sidebar (Members)', 'metro' ),
    	'description' => __( 'This is the members only secondary sidebar.', 'metro' ),
    ) );
    
    //* Show Members only custom Primary sidebar in Primary Sidebar location
    
    add_action( 'genesis_after_header', 'sk_change_genesis_primary_sidebar' );
    function sk_change_genesis_primary_sidebar() {
    
    	if( is_user_logged_in() && is_active_sidebar( 'members-primary' ) ) {
    
    		// Remove the Primary Sidebar from the Primary Sidebar area.
            remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
    
    		add_action( 'genesis_sidebar', 'sk_do_sidebar' );
    	}
    
    }
    
    function sk_do_sidebar() {
    
    	dynamic_sidebar( 'members-primary' );
    
    }
    
    //* Show Members only custom Secondary sidebar in Secondary Sidebar location
    
    add_action( 'genesis_after_header', 'sk_change_genesis_secondary_sidebar' );
    function sk_change_genesis_secondary_sidebar() {
    
    	if( is_user_logged_in() && is_active_sidebar( 'members-secondary' ) ) {
    
    		// Remove the Secondary Sidebar from the Secondary Sidebar area.
            remove_action( 'genesis_sidebar_alt', 'genesis_do_sidebar_alt' );
    
    		add_action( 'genesis_sidebar_alt', 'sk_do_sidebar_alt' );
    	}
    
    }
    
    function sk_do_sidebar_alt() {
    
    	dynamic_sidebar( 'members-secondary' );
    
    }

    #67678

    anitac
    Participant
    Post count: 6991

    Thank you, @sridhar. I’ll give it a try.


    Let me help you customize your theme, responsive header, Buddypress, Agentpress or technical issue!
    Visit me here: Cre8tiveDiva.com | Tweet Me! | Plus Me!
    When asking for help, please provide a link or screen shot showing your problem!

    #68247

    anitac
    Participant
    Post count: 6991

    @sridhar, I just had the opportunity to try this on the demo to make sure I could get it to work. I have it working, but when I am logged in, I still get the contents in the Red box – http://awesomescreenshot.com/0f41v2l08a. Is there a way to remove that and have the widget below it show up closer to the top?


    Let me help you customize your theme, responsive header, Buddypress, Agentpress or technical issue!
    Visit me here: Cre8tiveDiva.com | Tweet Me! | Plus Me!
    When asking for help, please provide a link or screen shot showing your problem!

    #68565

    Sridhar Katakam
    Participant
    Post count: 923

    That is not supposed to happen because in the code we are asking it to show the custom Members only sidebar in Secondary Sidebar location.

    Can you send me the WP and cPanel/FTP login via http://sridharkatakam.com/contact/ so I can take a look outside?


    #69537

    anitac
    Participant
    Post count: 6991

    Ok, sending an email to you now. If I put a blank text widget in that area it disappears though.


    Let me help you customize your theme, responsive header, Buddypress, Agentpress or technical issue!
    Visit me here: Cre8tiveDiva.com | Tweet Me! | Plus Me!
    When asking for help, please provide a link or screen shot showing your problem!

    #69608

    Sridhar Katakam
    Participant
    Post count: 923

    It was happening because of Genesis Simple Sidebars being extra “helpful” and showing that friendly widget :D.

    I have deactivated that plugin and that extra widget is now gone.


    #69616

    anitac
    Participant
    Post count: 6991

    Thanks again!


    Let me help you customize your theme, responsive header, Buddypress, Agentpress or technical issue!
    Visit me here: Cre8tiveDiva.com | Tweet Me! | Plus Me!
    When asking for help, please provide a link or screen shot showing your problem!

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.