Resources

My Agape try

Your Agape try


Support Forum

You must be logged in to post Login Register

Search 
Search Forums:


 




Using Role Scoper to Manipulate Content

UserPost

8:16 pm
May 3, 2010


nslatter

Member

posts 2

1

Kevin:  Another topic would be better. I'm not sure exactly what you're asking for… directions on how to develop a widget, or just how to pull RS data to put into your widget shell. Or are you asking to generate a full sidebar as it would appear if a user of "group X" was logged in. Please answer in the new topic.

I would like for "Test Role 1″ sidebar to show up on the front page when a person with that role (Test Role 1) is logged in. But not for any other group. So the latter question you asked is the one I was going for.  My end goal is to have "dynamic" navigation dependent upon groups.

I actually attempted to use the code in the original topic ( http://agapetry.net/forum/role-scoper/check-if-user-has-a-certain-role/page-1/ ) and manipulating it to pull the sidebar in but was unsuccessful — probably because of my lack of understanding more than anything.

I apologize for not being clear. I'm like that in real life, too. :D

Thanks for your help.

Nate

8:38 pm
May 4, 2010


Kevin

Admin

posts 2402

2

Find the spot in your theme code that calls dynamic_sidebar(). This is usually in sidebar.php. You can pass that function a sidebar id, and do so only if the logged user is in a certain group:

global $current_user;

$group = ScoperAdminLib::get_group_by_name( "Test Users" );

if ( in_array( $group->ID, $current_user->groups ) )
  dynamic_sidebar( 'your-sidebar-id' );

If it doesn't seem to work, see the dynamic_sidebar function definition in wp-includes/widgets.php for details on some quirks with the sidebar ID.


About the Agapetry forum

Currently Online:

14 Guests

Maximum Online: 150

Forums:

Groups: 2

Forums: 7

Topics: 1186

Posts: 5409

Members:

There are 1176 members

There are 1 guests


Kevin has made 2402 posts

Top Posters:

metal450 - 159

Ragnar - 105

YikYak - 70

whiteorb - 44

Daisy - 35

Administrator: Kevin | Moderators: Kevin