Assign to Group-Expired User [SOLVED]

14 years 8 months ago #106637 by BoSchafers
Assign to Group-Expired User [SOLVED] was created by BoSchafers
I've set up quite a few additional user groups in Joomla 1.5 using NoixACL.

What I would like to do is assign members to a specific group when their CB plan expires. This is mainly so we can target them with specifc newletters, reminders etc.(we are a society with 1000's of members, hoping to manage our memberships with CBsubs)

Example:
*******
Active Group: Associate Member 1 Year Membership Active
Expired Group: Associate Member 1 Year Membership Expired

Is this possible?

I've been through the manual and have tried to search the forum and have found very little about it....so sorry if it's documented somewhere.

Thanks for any input

Bo

Post edited by: BoSchafers, at: 2009/08/12 16:38

Please Log in to join the conversation.

14 years 8 months ago #106638 by krileon
SQL actions plugin using the following query (don't forget to modify it to meet your needs).

UPDATE `#__users` SET `usertype` = 'Registered', `gid` = '18' WHERE `id` = [user_id];
UPDATE `#__core_acl_groups_aro_map` SET `group_id` = '18' WHERE `aro_id` = [user_id];

Change:
usertype
gid
group_id

To match your user group. I suggest making a backup before running this SQL query or any query for that matter. Test thoroughly!


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.

14 years 8 months ago #106683 by BoSchafers
Replied by BoSchafers on topic Re:Assign to Specific Group-Expired Subscription
Thanks for your fast reply. Also, it's fantastic that CBsubs has the capability to do what I was looking to do.

BUT! I wish I had a bit more of an understanding of the workings of Joomla and mysql....

Some clarification, please:

__users
__core_acl_groups_aro_map

These are the names of the actual database tables? In my case jos_users and jos_core_acl_groups_aro_map. Yes?

SET `usertype` = 'Registered'
`gid` = '18' WHERE `id` = [user_id];

So this is the user type/group and id that I'd like to change it to such as "Associate Member 1 Year Membership Expired". It is NOT not the value of current group? Yes? Ok. I think I got it thus far. So the update statement changes the values for that the user in the user's table.

Now to the second statement ...

SET `group_id` = '18'

I just put in the same value in group_id as for 'gid' above i.e. 18? Yes?

Sorry for being long-winded and perhaps a bit daft, but I'd just like to be sure and hopefully this will be of use to other newbies down the track.

TIA,
Bo

Please Log in to join the conversation.

14 years 8 months ago #106710 by krileon
Yes gid and group_id are one in the same. For the tables just leave it as is. The #_ will use the correct prefix. Use the exact query I gave above except change the usertype, gid, and gorup_id.

To find usertypes and their ids examine the database table jos_core_acl_aro_groups. The ID column is gid and group_id. The value column is the usertype.


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.

14 years 8 months ago #107302 by BoSchafers
Replied by BoSchafers on topic Re:Assign to Specific Group-Expired Subscription
Ok I finally managed to test this and it works. Almost :P

The sql statements *are* actually putting the user into the 'Lapsed' Group at expiration. However in the 'User Management' listing the 'Group' column is displaying the old group title (not the new one).

Currently these are my sql statements I have entered in the plugin. Are these right?

[code:1]
SQL Action 1 Field:
******************

UPDATE `#__users` SET `usertype` = 'Lapsed', `gid` = '59' WHERE `id` = [user_id];

SQL Action 2 Field:
*******************

UPDATE `#__core_acl_groups_aro_map` SET `group_id` = '59' WHERE `aro_id` = [user_id];
[/code:1]

Please Log in to join the conversation.

14 years 8 months ago #107353 by krileon
Your usertype isn't an official Joomla usertype. I don't know the result of doing this. You're altering a users ACL level which CB isn't designed for. There maybe more SQL Actions to perform in order to update the users. I suggest thoroughly inspecting your database to ensure you've updated all the necessary tables. You need to also keep in mind the usertype, id, etc.. MUST match what is in the ACL table as well.

Post edited by: krileon, at: 2009/08/09 05:44


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.217 seconds

Facebook Twitter LinkedIn