Resources

My Agape try

Your Agape try


Support Forum

You must be logged in to post Login Register

Search 
Search Forums:


 




Add user to RS Group

UserPost

5:07 pm
February 18, 2009


danf

Member

posts 24

1

Hi Kevin - I know if I keep looking hard enough I can find it, but if you can shed some light it would be great.  I am modifying my registration page where they will be dynamically added to certain RS groups based on what they select on the registration form.  Is there a simple function to add_user_to_group($user, $group)?  Im sure there is, just not looking in the right place. 


In general, which file should I be looking at to do things like: get_all_groups()?  Im not seeing that in the role-scoper_main.php file.


Thanks

10:35 am
February 19, 2009


Kevin

Admin

posts 2502

2

The functions you need are in role-scoper/admin/admin_lib_rs.php . That file is always loaded during any wp-admin access.

ScoperAdminLib::add_group_user($group_id, $user_id);

ScoperAdminLib::remove_group_user($group_id, $user_id);

$groups = ScoperAdminLib::get_all_groups();
foreach ( $groups as $group ) {
  echo "group $group->ID : $group->display_name - $group->descript";
}

Before using those function calls, you should upgrade to the latest Role Scoper Development Snapshot. I discovered that, under some circumstances, those functions were not updating cached results.

Also, prior to this revision, the get_all_groups function required the argument UNFILTERED_RS to include all groups regardless of who is logged in.

11:07 am
February 19, 2009


danf

Member

posts 24

3

Thanks Kevin!


5:35 pm
February 24, 2009


danf

Member

posts 24

4

Kevin - what if Im not in the back-end? 

Can I simply do: require_once(SCOPER_ABSPATH . "admin/admin_lib_rs.php");

at the top of my page?


6:44 pm
February 24, 2009


Kevin

Admin

posts 2502

5

You can do that, but shouldn't need to. Unless you have enabled the "assume no front-end admin" option, admin_lib_rs.php and the ScoperAdminLib class it contains should be loaded even on front end access.

7:19 am
March 22, 2009


johnnypea

Member

posts 3

6

I would like to modifiy my registration form in this way, please can you create simple "HOW-TO" and help me with this? http://agapetry.net/forum/new-forum/chooser-rs-group-upon-registration/page-1/post-1161/#p1161 Thank You in advance.

9:56 am
March 24, 2009


Kevin

Admin

posts 2502

7

The functions mentioned above would be all the Role Scoper interaction you need.

Given my current situation, I am not able to volunteer the time to further document those function or provide a how-to tutorial. I am available for hire to provide that documentation and training, or to develop a solution which integrates with Role Scoper.


About the Agapetry forum

Currently Online:

14 Guests

Maximum Online: 150

Forums:

Groups: 2

Forums: 7

Topics: 1244

Posts: 5649

Members:

There are 1254 members

There are 1 guests


Kevin has made 2502 posts

Top Posters:

metal450 - 178

Ragnar - 108

YikYak - 70

whiteorb - 49

Daisy - 35

Administrator: Kevin | Moderators: Kevin