J 1.6 User Groups

13 years 1 month ago #156403 by bgies
J 1.6 User Groups was created by bgies
My setup: J 1.6, CB 1.4, CBSubs 1.1.2

First, I have several J 1.6 custom user groups. The user groups have "Public" as the parent.

I have 3 plans set up and each plan should put the user into one of my custom groups. I have the "Homeowner" plan "Access/User Group" drop down set to my custom group "Homeowner", but when a new user registers and selects the plan they are put into the "Registered" group.

I suppose what I really want is the ability to select more than one group, so they end up being in the "Registered" group as well as the "Homeowner" group, but I NEED them to go into the "Homeowner" group as they don't have access to any of the functions they should have access to without it.

Any workaround?

Please Log in to join the conversation.

13 years 1 month ago #156812 by krileon
Replied by krileon on topic Re: J 1.6 User Groups
Currently CBSubs is not rated for Joomla 1.6. It needs some adjustments which will be available with next release to support J1.6 ACL. I suppose you could use CBSubs SQL Actions to add users to a new group (relatively easy), but please be careful as this COULD cause issues. At any rate the below query will add users to a new group.
INSERT INTO `#__user_usergroup_map` ( `user_id`, `group_id` ) VALUES ( [user_id], GROUP_ID );

Replace GROUP_ID with the actual id of the group, which you can find in _usergroups database table. If this group is supposed to be "above" or more privileged then Registers users you need to also update the _users table and adjust the usertype column. Example query as follows.
UPDATE `#__users` SET `usertype` = 'GROUP_TITLE' WHERE `id` = [user_id];

Replace GROUP_TITLE with the actual title of the group, which you can find in _usergroups database table.

This would mean the below is what you'd have in your activation query of CBSubs SQL Actions of your place if you wanted the user to be an Author for instance.
INSERT INTO `#__user_usergroup_map` ( `user_id`, `group_id` ) VALUES ( [user_id], 3 );
UPDATE `#__users` SET `usertype` = 'Author' WHERE `id` = [user_id];


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.

13 years 1 month ago #156821 by bgies
Replied by bgies on topic Re: J 1.6 User Groups
Kyle,

Thanks for the code! I came up with a little different version of it (just added a NOT EXISTS) to make sure I wasn't duplicating the entries... but it seems that SQL Actions don't work in CB Subs with J 1.6 either :(

It's not critical anyway. My extensions are custom so I just added a check for the plan, and create the user_usergroup_map entry if it doesn't exist when they try to enter the component, and then took out the CB Subs Component Management entries (will add it back when CB Subs is J 1.6 compliant).

I kind of expect some issues using CB Subs until the J 1.6 version is released, but it's a new website (non-existent to very low traffic) and I want CB Subs on it for the long term, so for me it makes more sense to use it as much as possible.

Please Log in to join the conversation.

13 years 1 month ago #156829 by bgies
Replied by bgies on topic Re: J 1.6 User Groups
Oh... sorry... one more question... (always one more).

Is there an API for CB Subs?

In my custom extension, I have an error page that the user is directed to if they don't have the correct plan for that extension. What I'd like to do is simply display a message saying that "You don't have access to this because you have not selected "Plan ??", and then ask if they would like to add that plan, and if they do, just add the plan from my component and redirect them to the main view.

I know that I could redirect them to their profile where they could add the plan, but I'd prefer it to be a one click solution. I can probably figure out the SQL (mind sharing the code for this?) if I need to... but would prefer an API solution if possible for better upward compatibility.

Please Log in to join the conversation.

13 years 1 month ago #157442 by krileon
Replied by krileon on topic Re: J 1.6 User Groups

but it seems that SQL Actions don't work in CB Subs with J 1.6 either

Shouldn't be the case, SQL Actions aren't CMS dependent. If updating the _users table and giving a user a subscription from backend then it won't work as _users and _comprofiler manipulation doesn't work in backend through SQL Actions due to order of execution (known issue).

Is there an API for CB Subs?

Not yet, for now direct queries will be necessary to get user subscription information.


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