Skip to Content Skip to Menu

limit moderators to only be able to edit profiles of users on selected plans

  • joomally
  • joomally
  • OFFLINE
  • Posts: 104
  • Thanks: 8
  • Karma: 1
4 years 7 months ago #317519 by joomally
I read this post

www.joomlapolis.com/forum/154-advanced-members-support/224717-solved-can-i-give-my-moderators-cb-user-manager-access?start=6#241995

and others like it, which explain that moderators can only edit other user's profile in the following situation:

Public
- Registered <- Can Edit
- - Members 1 <- Can Edit
- - - Moderator <- CB Moderator
- - Members 2 <- Can NOT Edit

I have set up my user groups as follows:

Public
- Registered
- - Members 1
- - - Moderator 1
- - Members 2
- - - Moderator 2

users sign up on Plan 1, and are put in the 'Members 1' user group
users sign up on Plan 2, and are put in the 'Members 2' user group

'Moderator 1' should only be allowed to edit profiles of those in 'Members 1' (ie signed up to Plan 1)
'Moderator 2' should only be allowed to edit profiles of those in 'Members 2' (ie signed up to Plan 2)

The issue that I'm having is that when people sign up for a plan as part of the registration, they are assigned to the 'Registered' group, and then any moderator can edit their profile.

Is there a way to limit which user's profiles moderators can edit for users who sign up on plans ?

Thanks

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
4 years 7 months ago #317532 by krileon
CBSubs will only manage usergroups it's configured to manage. Create a free lifetime plan for example and have that plan assign the Registered usergroup. It ideally should then remove it when users subscribe to Plan 1 or Plan 2. Aside from that you'd need a more advanced usage through CB Auto Actions where you can completely replace someones usergroups.


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 or Create an account to join the conversation.

  • joomally
  • joomally
  • OFFLINE
  • Posts: 104
  • Thanks: 8
  • Karma: 1
4 years 7 months ago #317545 by joomally
Thanks for the reply.
How do I set it to 'remove it when users subscribe to Plan 1 or Plan 2.'
Is there a setting for that, or do I have to use CBSubs ?
Thanks

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
4 years 7 months ago #317568 by krileon
To have CB Auto Actions control usergroups first edit your plans and under Access ensure your plans are not controlling usergroups anymore. Next use the below usage with a Usergroup action, which can be used to add, remove, and replace usergroups when a specific plan becomes active or inactive.

Plan Active
Global
Triggers: onCPayUserStateChange
User: Automatic
Access: Everybody
Conditions (custom value conditions)
1: [var3] Equal To PLAN_ID_HERE
2: [var2] Equal To A

Plan Expired
Global
Triggers: onCPayUserStateChange
User: Automatic
Access: Everybody
Conditions (custom value conditions)
1: [var3] Equal To PLAN_ID_HERE
2: [var2] Not Equal To A

Replace PLAN_ID_HERE with the ID of the plan you want this to act on.


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 or Create an account to join the conversation.

  • joomally
  • joomally
  • OFFLINE
  • Posts: 104
  • Thanks: 8
  • Karma: 1
4 years 7 months ago #317903 by joomally
I've been struggling with finding a good way to achieve this.

I would like to the plans to control the usergroups as specified on each plan's Access tab. This is because I dont want to have to edit the CB Auto Action each time a new plan is added.

I thought that the following would work:

1. A CB Query field who's value is a count of the number of subscriptions (including shares via family plans) the user has.
2. A User Group Auto Action, triggered on onUserBeforeSaveGroup and onUserBeforeDeleteGroup which looks at the value of the CB Query Field. If the user has any plans (ie the value is greater than zero), then 'Remove Usergroups' the user group 'Registered'.
3. A User Group Auto Action, triggered on onUserBeforeSaveGroup and onUserBeforeDeleteGroup which looks at the value of the CB Query Field. If the user has no plans (ie the value equals zero), then 'Add Usergroups' the user group 'Registered'.


Do you think this would work, and could you suggest the correct SQL for the CB Query (or a pointer to some documentation on the table schema)?
Also just to confirm that the Auto Actions wouldn't result in an infinite loop ?

Thanks

Please Log in or Create an account to join the conversation.

  • joomally
  • joomally
  • OFFLINE
  • Posts: 104
  • Thanks: 8
  • Karma: 1
4 years 7 months ago #317906 by joomally
I found another way to do this that doesn't require the use of the CB Query field.

I have set up the Auto Actions and they are working. They add or remove the 'Registered' group as needed, based on the state of the user object.

The only issue is that I'm not sure what to use as a trigger.

At the moment (for the sake of testing), the trigger is onAfterUpdateUser. In order to test that the Actions are working, I click on a user in the administrator back end, and then save the profile. This fires the Auto Action. Obviously this is not a long term solution and is just useful to test the Auto Action.

Is there an appropriate trigger that I can use ? The onCPayUserStateChange does not have the desired results.
Thanks

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum