Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Sidebars & Widgets (http://forum.bytesforall.com/forumdisplay.php?f=14)
-   -   [SOLVED] Exclude sidebar for logged-in user (http://forum.bytesforall.com/showthread.php?t=10623)

everyman Oct 24, 2010 08:11 AM

[SOLVED] Exclude sidebar for logged-in user
 
Jugglead,

first of all you are a star of this forum -- I just sent you a small token of appreciation.

I saw your earlier reply to a question about how to reverse the include/exclude logic for sidebar inclusion (ie. to have the "exclude sidebar on pages X" become "include sidebar on pages X". My question a bit different, I want to EXCLUDE the sidebar for all logged-in users (it's a membership site and for non-logged in users I want to show advertisements). I would setup a right sidebar for all my posts and then tweak that with a

if(... && !is_user_logged_in() ) {
Show the sidebar...

I am hoping you can point me in the right direction

thanks!

everyman Oct 24, 2010 08:14 AM

Forgot to include link to earlier post

http://forum.bytesforall.com/showthread.php?t=863

juggledad Oct 24, 2010 01:14 PM

Edit the lines (389, 400, 411 and 422) in bfa_get_options.php and change them from
HTML Code:

                if ( $bfa_ata['leftcol_on']['page'] AND !in_array($current_page_id, $pages_exlude_left) ) {
HTML Code:

                if ( $bfa_ata['leftcol_on']['page'] AND in_array($current_page_id, $pages_exlude_left) AND !is_user_logged_in() ) {
- get rid of the '!' and add teh last part.

This will cause any page mentioned in the exclude list, not to display if you are logged in.

juggledad Oct 24, 2010 03:53 PM

STB - the plugins will prevent the widgets showing, but the sidebar will still be there. You'd need the code to keep the entire sidebar from showing

everyman Oct 24, 2010 06:13 PM

thanks guys. I actually wanted to disable sidebar for logged-in users on POSTS but I found this a bit below the code you mentioned above (after a long "if"):

PHP Code:

            $cols++; $right_col "on"


and replaced it with
PHP Code:

        if (!is_user_logged_in()) {
            
$cols++; $right_col "on"
        } 

which worked nicely.

thanks for your help!


All times are GMT -6. The time now is 09:18 AM.

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