Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Sidebars & Widgets »

[SOLVED] Hide the right sidebar for subscribers


  #1  
Old May 3, 2011, 08:39 PM
dcclxi
 
10 posts · May 2011
[SOLVED] Hide the right sidebar for subscribers

Hello,

First thank so much for this theme, I have spent months looking for something flexible enough but still easy to use and Atahualpa is simply perfect!

My question is about the sidebars. I would like to know how I can hide the right sidebar if the user is "only" a subscriber.

The website I have set up is only accessible to registered users. They are divided into two classes: those who are subscribers and those are not. The subscribers have a restricted view of the content (they only see posts from one category only). That restriction unfortunately does not spread to all widgets, so I would like to hide the right sidebar (to hide its widgets).

I took a look at the theme code via the WP Editor, but I can't work out where the Atahualpa code creates the HTML/CSS for the sidebars. I thought that perhaps I could add a
if (!current_user_can('delete_posts') ) { ... } // user is a subscriber
somewhere, but I don't find the right place.

I would prefer not to have to do any code change, but so far it is the only solution that is likely to work.

I would really appreciate any help on this...
dcclxi
  #2  
Old May 3, 2011, 10:30 PM
lmilesw's Avatar
lmilesw
 
10,176 posts · Jul 2009
Central New York State USA
I did a little digging and the following will hide the right sidebar if a user is logged in. Not sure how you would limit to subscriber etc. but maybe it's a start. I put this in CSS Inserts.
HTML Code:
<?php if ( is_user_logged_in() ) { ?>
.colthree, td#right {
    display: none;
}
<?php } ?>
__________________
~Larry (CNY Web Designs)
This site should be a membership site since it so full of good stuff.
Please consider donating which gives you access to even more good stuff.
  #3  
Old May 4, 2011, 08:52 PM
dcclxi
 
10 posts · May 2011
Thank you so much for such a quick answer!

I tried it, it half works: the sidebars (I went for hiding both the left and right one) are hidden, but the central area then shrinks to the width of the (disappeared) left sidebar (or at least looks like it). I can't work out why.

I kept playing a bit with the code and eventually got to this (in css.php) :

HTML Code:
/*-------------------- LAYOUT to keep it all together -----*/
	
table#layout {
	font-size: 100%;
	width: 100%;
	table-layout: fixed;
	}

.colone {width: <?php echo $bfa_ata['left_sidebar_width']; ?>px;}
.colone-inner {width: <?php echo $bfa_ata['left_sidebar2_width']; ?>px;}
.coltwo { width: 100% }
.colthree-inner {width: <?php echo $bfa_ata['right_sidebar2_width']; ?>px;}
.colthree {width: <?php echo $bfa_ata['right_sidebar_width']; ?>px;}

/* code change, start */
<?php if ( !current_user_can('delete_posts') ) { ?>
	.colone, .colthree {
		...
	}
<?php } ?>
/* code change, end */
The php line ensures this code change only applies to subscribers (see table at http://codex.wordpress.org/Roles_and_Capabilities).
The "..." bit can be:
HTML Code:
display: none;
which leads to a weird behaviour. Or:
HTML Code:
width: 0px;
which does shrink both sidebars to 0px, allows the central area to spread wider, but the sidebar content logically overflows (hence not hidden).

If you have any idea... There must be a place in all the php files of the theme where the user's choice regarding whether to display or not a sidebar (left, left inner, right inner, right) is retrieved. Perhaps that is where the code change should be done?
  #4  
Old May 4, 2011, 08:57 PM
lmilesw's Avatar
lmilesw
 
10,176 posts · Jul 2009
Central New York State USA
I avoid editing theme files except for bug fixes and the like as they won't survive an upgrade and I don't want to have to document all the changes I made to a particular installation so I can "redo" the hacks. That's why I stick primarily with code in the theme options and is why I like this theme so much in that you can do most anything you want within the theme options if you think through it.
__________________
~Larry (CNY Web Designs)
This site should be a membership site since it so full of good stuff.
Please consider donating which gives you access to even more good stuff.
  #5  
Old May 4, 2011, 09:27 PM
dcclxi
 
10 posts · May 2011
I don't like editing the theme either, I wish I could find another way to hide these sidebars. I'll keep searching :-).
  #6  
Old May 4, 2011, 09:39 PM
lmilesw's Avatar
lmilesw
 
10,176 posts · Jul 2009
Central New York State USA
Was the code you put in CSS Inserts something like the following without any of the other code you tried?
HTML Code:
<?php if ( is_user_logged_in() ) { ?>
.colthree, td#right, .colone, td#left {
    display: none;
}
<?php } ?>
I just put that in my test site and when logged in see no sidebars. It would seem all you have to do if figure out how to determine the code for what type of use is logged in.
__________________
~Larry (CNY Web Designs)
This site should be a membership site since it so full of good stuff.
Please consider donating which gives you access to even more good stuff.

Bookmarks

Tags
sidebar, sidebar coding, users



Similar Threads
Thread Thread Starter Forum Replies Last Post
Feedburner shows 0 subscribers, Google reader shows 91 subscribers? Patty RSS, Feeds & Subscribing 0 Feb 24, 2011 08:29 PM
Not showing subscribers ProtinaseMegan RSS, Feeds & Subscribing 1 Jun 2, 2010 05:27 PM
Hide a Post but have a Link to it in Sidebar treeplant Center area post/pages 6 Apr 18, 2010 07:22 PM
[SOLVED] How to hide or make invisible Text-Widget in sidebar multiram Sidebars & Widgets 4 Jul 23, 2009 08:02 AM
Hide subcategories in right sidebar Radical Sidebars & Widgets 0 May 15, 2009 05:12 AM


All times are GMT -6. The time now is 06:21 PM.


Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.