Resources

My Agape try

Your Agape try


Support Forum

You must be logged in to post Login Register

Search 
Search Forums:


 




Using RS to modify WP Dashboard

UserPost

12:54 pm
February 2, 2009


uscmenslax

Member

posts 2

1

Kevin,

Great plugin!  Thanks for the hard work!  I'm a former Michigander, so I'm glad to see "the mitten" pumping out some good stuff and not just more junk on 4 wheels.

I have created a plugin for my site that clears the Dashboard for all users and will (with your help) display different things based on the user's RS-defined role.

It's a lacrosse team's website, so RS-defined roles are Player, Captain, and Coach.  The public will fall into the default WP-defined Subscriber category.

2 things I'd like to accomplish:

-  Display different information on the dashboard based on the user's WP or RS defined role.  I'm fairly certain the hooks exist in RS to do this, I just can't figure out how.

- (long-shot request) Allow the user, during registration, to request membership in a given RS-defined group.

Thanks again.  I look forward to your response.

- Dave

12:55 am
February 7, 2009


Kevin

Admin

posts 2402

2

uscmenslax said:

Kevin,

Great plugin!  Thanks for the hard work!  I'm a former Michigander, so I'm glad to see "the mitten" pumping out some good stuff and not just more junk on 4 wheels.


I try to keep some positive momentum even though I'm not sure where it's taking me.

-  Display different information on the dashboard based on the user's WP or RS defined role.  I'm fairly certain the hooks exist in RS to do this, I just can't figure out how.

The easiest solution may be to just let the internal hooks run their course by calling current_user_can('wprolename') or current_user_can('rs_post_contributor'), etc.

- (long-shot request) Allow the user, during registration, to request membership in a given RS-defined group.


Good idea. Next week I'll poke around and see what kind of work that would involve.

1:02 am
February 7, 2009


Kevin

Admin

posts 2402

3

Since the developer doc is currently nonexistant, let me also mention the properties of $current_user which may be helpful to you:

var $groups = array(); 		// $groups[group id] = 1
var $blog_roles = array(); 	// $blog_roles[role_handle] = 1
var $term_roles = array();	// $term_roles[taxonomy][role_handle] = array of term ids 
var $assigned_blog_roles = array(); // $assigned_blog_roles[role_handle] = 1
var $assigned_term_roles = array(); // $assigned_term_roles[taxonomy][role_handle] = array of term ids 

So you could do something like:

global $current_user;
$required_group_id = 4;
if ( ! empty( $current_user->groups[$required_group_id] ) )
  // display special group stuff

12:58 pm
February 11, 2009


uscmenslax

Member

posts 2

4

Kevin said:

Since the developer doc is currently nonexistant, let me also mention the properties of $current_user which may be helpful to you:

var $groups = array(); 		// $groups[group id] = 1
var $blog_roles = array(); 	// $blog_roles[role_handle] = 1
var $term_roles = array();	// $term_roles[taxonomy][role_handle] = array of term ids 
var $assigned_blog_roles = array(); // $assigned_blog_roles[role_handle] = 1
var $assigned_term_roles = array(); // $assigned_term_roles[taxonomy][role_handle] = array of term ids 

So you could do something like:

global $current_user;
$required_group_id = 4;
if ( ! empty( $current_user->groups[$required_group_id] ) )
  // display special group stuff

Wow, that's a lot to soak in… but incredibly useful.  I'm still trying to wrap my mind around how all this fits together… but this is a great start for me… thanks!

11:21 am
February 23, 2009


Kevin

Admin

posts 2402

5

Kevin said:

uscmenslax said:

- (long-shot request) Allow the user, during registration, to request membership in a given RS-defined group.


Good idea. Next week I'll poke around and see what kind of work that would involve.


After further consideration, I'm not going to pursue that feature. Role Scoper groups are normally a way for administrators to grant permissions to users, not for users to pick and choose from available content. What you're asking is for Role Scoper groups to work more like Organic Groups in Drupal. That would lead to a whole new class of functionality that may be better handled in a separate plugin. Even if I decided to go in that direction, I would need to do some very careful UI design to make sure admins understand what they're enabling users to do at registration.


About the Agapetry forum

Currently Online:

13 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