Community Forums › Forums › Archived Forums › Design Tips and Tricks › Template with Member Only Sidebars
- This topic has 9 replies, 3 voices, and was last updated 10 years, 5 months ago by Anita.
-
AuthorPosts
-
October 19, 2013 at 8:43 am #67651AnitaKeymaster
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?
Love coffee, chocolate and my Bella!
October 19, 2013 at 9:20 am #67657Brad DaltonParticipant1. 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.
October 19, 2013 at 9:22 am #67658AnitaKeymaster.....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!
Love coffee, chocolate and my Bella!
October 19, 2013 at 10:28 am #67675Sridhar KatakamParticipantAdd 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' ); }
October 19, 2013 at 10:48 am #67678October 22, 2013 at 12:16 pm #68247AnitaKeymaster@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?
Love coffee, chocolate and my Bella!
October 24, 2013 at 2:08 am #68565Sridhar KatakamParticipantThat 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?
October 28, 2013 at 4:48 pm #69537AnitaKeymasterOk, sending an email to you now. If I put a blank text widget in that area it disappears though.
Love coffee, chocolate and my Bella!
October 29, 2013 at 6:28 am #69608Sridhar KatakamParticipantIt 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.
October 29, 2013 at 7:09 am #69616AnitaKeymasterThanks again!
Love coffee, chocolate and my Bella!
-
AuthorPosts
- The topic ‘Template with Member Only Sidebars’ is closed to new replies.