Page 1 of 1

Blocking widgets on homepage only?

PostPosted: July 2nd, 2010, 12:01 pm
by mobodojo
Here one that looks like it's one for the books, Jason :) I have a site configured to only allow access to the homepage, login, and registration elements. The site is a WP/BP site at http://www.mspboards.com and its a social networking site for IT and MSP folk. I want to be able to include the BP widebar widget which shows the avatars of all recent users, but it also shows up on the homepage where non-members can see it. Is there anyway to prevent this from happening? One of your magical URI replacements, probably?

BTW, thanks for the fantastic plugin, as it is exactly what I needed. I think you could easily claim a powerhouse hattrick by generating a version which does all of the blocking and member control, but doesn't involve any of the pay stuff. MSPBoards is open and free for all. The PayPal integration may turn some people off.

Thanks!

Tyler

Re: Blocking widgets on homepage only?

PostPosted: July 7th, 2010, 4:52 pm
by Jason Caldwell
Hi Tyler. Thanks for the Kudos, and great suggestions.
There are other ways around this, but my favorite solution ( most elegant I think ), is to have your theme implement two different Sidebars. In your theme file, usually inside the file "sidebar.php", you can do something like this:

register_sidebar(array ("name" => "Default Sidebar", "description" => "Visible to public."));
register_sidebar(array ("name" => "Member Sidebar", "description" => "Only for Members."));


Code: Select all
<?php

if(is_user_logged_in())
    {
        dynamic_sidebar ("Member Sidebar");
    }
else
    {
        dynamic_sidebar ("Default Sidebar");
    }
?>

Once you have that in place, you can manage everything gracefully through the Appearance -> Widgets menu in WordPress. The s2Clean Theme works like this. It also uses two separate menus for navigation as well.