Special userlists, access levels and groupjive groups

10 months 2 weeks ago #333846 by PaceOnline
Hi guys. 1. We would like to create a userlist that contains everyone who either owns or is an admin and a moderator of a Groupjive group. How can we configure this?  

2. We have an access level for owners, another for admins and another for moderators of groups and we would like an auto action that will add and remove users to and from these user groups when they are promoted or demoted in groupjive.

Please Log in to join the conversation.

10 months 2 weeks ago #333849 by krileon

1. We would like to create a userlist that contains everyone who either owns or is an admin and a moderator of a Groupjive group. How can we configure this?

You'll need to add an advanced filter to your userlist to filter the userlist down to users of that group and of a specific status. Example as follows.
( SELECT COUNT(*) FROM `#__groupjive_users` AS gj WHERE gj.`user_id` = u.`id` AND gj.`status` >= 1 AND gj.`group` = GROUP_ID_HERE ) >= 1

Replace GROUP_ID_HERE with the ID of the group you want to check against. gj.`status` >= 1 is checking if they're approved in the group, but you can adjust this to gj.`status` >= 2 to return moderators and above. The statuses are as follows.

-1 = Banned
0 = Pending
1 = Member
2 = Moderator
3 = Admin
4 = Owner

2. We have an access level for owners, another for admins and another for moderators of groups and we would like an auto action that will add and remove users to and from these user groups when they are promoted or demoted in groupjive.

Create a usergroup action acting on gj_onAfterUpdateUser and gj_onAfterCreateUser then checking against their status. Example as follows.

Global
Triggers: gj_onAfterUpdateUser,gj_onAfterCreateUser
Type: Usergroup
User: Automatic
Access: Everybody
Conditions
Condition 1
Field: Custom > Usergroups
User: Action User
Operator: Does Not Have
Usergroups: SELECT_USERGROUP_HERE
Condition 2
Field: Custom > Value
Custom Value: [var1_status]
Operator: Equal To
Value: GROUP_STATUS_HERE
Action
Mode: Add Usergroups
Groups: SELECT_USERGROUP_HERE

Replace GROUP_STATUS_HERE with the status you want to check against. Refer to the list provided above. So for example set this to 4 to give the selected SELECT_USERGROUP_HERE usergroup to the user if they're a group owner.

Now to reverse this you'll want to do the following. Gets a bit trickier here as we need to use a Query condition to check against all their group status as we don't want to remove Owner for example if they stop being owner of 1 of 5 groups.

Global
Triggers: gj_onAfterUpdateUser,gj_onAfterDeleteUser
Type: Usergroup
User: Automatic
Access: Everybody
Conditions
Condition 1
Field: Custom > Usergroups
User: Action User
Operator: Has
Usergroups: SELECT_USERGROUP_HERE
Condition 2
Field: Custom > Query
Custom Query:
SELECT DISTINCT `status` FROM `#__groupjive_users` WHERE `user_id` = '[user_id]'
Operator: Does Not Contain
Value: GROUP_STATUS_HERE
Action
Mode: Remove Usergroups
Groups: SELECT_USERGROUP_HERE

Now this should remove SELECT_USERGROUP_HERE if the user is no longer of status GROUP_STATUS_HERE in any groups.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: PaceOnline

Please Log in to join the conversation.

5 months 2 weeks ago #335414 by PaceOnline
How can I adjust the auto actions so that they specify groups from a category rather than a specific group?

Please Log in to join the conversation.

5 months 2 weeks ago #335418 by krileon
var1 is the group user object and doesn't contain the category id. The group user object has a function to get its group object where the category id would exist. You should be able to use a PHP based condition to extract that information. Example as follows.

Field: Custom > Code
Custom Code:
return $variables['var1']->group()->getInt( 'category', 0 );
Operator: Equal To
Value: 5

This means the auto action would only run if the group is in the category with an id of 5.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.182 seconds

Facebook Twitter LinkedIn