Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount on memberships! Get 20% off now with code SPOOKY-2024!

[SOLVED] Family subscriptions with CBSubs and AutoActions

  • OldLodgeSkins
  • OldLodgeSkins
  • OFFLINE
  • Posts: 119
  • Thanks: 5
  • Karma: 2
  • Add-ons
10 years 10 months ago #238209 by OldLodgeSkins
I may have one tiny little question left...

I'm trying to block both the child and parent accounts in case of unsubscription. I'm using CBSubs SQL actions as you suggested. In my plan, right now, I have this:
Code:
UPDATE `#__users` SET `block` = 1 WHERE `username` = '[cb_family1user]'; UPDATE `#__users` SET `block` = 1 WHERE `username` = '[username]';

Note that I'm using the child account's user name now - which I collect earlier in the process just after generating it, this is stored in the parent account. I'm doing this because they could change their e-mail address so filtering on the e-mail isn't reliable enough.
The first request works fine and the child account gets blocked.
The second request doesn't work and I'm wondering why. I've checked and the owner's user name is indeed stored in a field named [username] in lower case... So I guess this should work.
Can I use the user ID there? [user_id] I guess? It's not listed in the examples on that page.

Thanks.

Seb.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48477
  • Thanks: 8281
  • Karma: 1443
10 years 10 months ago #238221 by krileon
It's supposed to split up the queries that end in a ; followed by a line break. So it should run the first query followed by the second query. Ensure there is an actual linebreak after ; of the first query.


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.

  • OldLodgeSkins
  • OldLodgeSkins
  • OFFLINE
  • Posts: 119
  • Thanks: 5
  • Karma: 2
  • Add-ons
10 years 10 months ago - 10 years 10 months ago #238413 by OldLodgeSkins
Hi,

They are both on their own line and just to make sure, I added an empty line between the two... Only the first query is being executed.
For a moment I wondered if there wouldn't be a problem with the where clause and my [username] field, but I created the "family 3" subscription (1 main account + 2 sub-accounts), so when unsusbscribing from this one I have one additional query, like this:
Code:
UPDATE `#__users` SET `block` = 1 WHERE `username` = '[cb_family1user]'; UPDATE `#__users` SET `block` = 1 WHERE `username` = '[cb_family2user]'; UPDATE `#__users` SET `block` = 1 WHERE `username` = '[username]';

I know both [cb_family1user] and [cb_family2user] are properly populated (plus, if they were not, the accounts wouldn't have been created anyway...) yet only the 1st query works.

Any idea why?

Thanks.

Seb.

Edit: forget the last part of my answer... I apparently had set the query for family2user only for expiration, not for deactivation. I'll test and see if it's being executed, if yes then it means the problem lies only with the main account's query.
Last edit: 10 years 10 months ago by OldLodgeSkins.

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

  • OldLodgeSkins
  • OldLodgeSkins
  • OFFLINE
  • Posts: 119
  • Thanks: 5
  • Karma: 2
  • Add-ons
10 years 10 months ago #238415 by OldLodgeSkins
Ok... The family2user query was executed, both sub-accounts were disabled.
The problem is definitely with the main account's query...

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48477
  • Thanks: 8281
  • Karma: 1443
10 years 10 months ago - 10 years 10 months ago #238416 by krileon
You could always just use a single query for that. Example as follows.

Code:
UPDATE `#__users` SET `block` = 1 WHERE `username` IN ( '[cb_family1user]', '[cb_family2user]', '[username]' )

Regarding why your current usage isn't working it's because after [cb_family1user] you're missing a single quote before ;. Notice it only has 1 quote. I'm surprised this works at all given the missing quote.

Am also unsure if you can even block a user at that time as they're going to be have their user object saved by CBSubs which will probably override your query change to the main account.


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.
Last edit: 10 years 10 months ago by krileon.

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

  • OldLodgeSkins
  • OldLodgeSkins
  • OFFLINE
  • Posts: 119
  • Thanks: 5
  • Karma: 2
  • Add-ons
10 years 10 months ago - 10 years 10 months ago #238418 by OldLodgeSkins
No I do have that quote, look closer...
Besides I've confirmed the second query with family2user is being executed just fine.
But if you think CBSubs may be be overriding my change then this would explain...
I'll look for another solution for the main account then. Maybe change its group which would deny him access just as surely as blocking his account since all the features reserved to my subscribers depend on a particular group...
Last edit: 10 years 10 months ago by OldLodgeSkins.

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

Moderators: beatnantkrileon
Powered by Kunena Forum