Skip to Content Skip to Menu

🕒 Save Time and Effort with CB Editor Assistant: Effortlessly create and refine content in Joomla 3, 4, & 5.
🎁 Limited Offer: Enjoy a 5-day FREE trial and save up to 30% afterward!

[SOLVED] Managing family membership via auto-action?

  • fribse2011
  • fribse2011
  • OFFLINE
  • Posts: 921
  • Thanks: 79
  • Karma: 8
7 years 11 months ago #291286 by fribse2011
Replied by fribse2011 on topic Managing family membership via auto-action?
This was a static SQL query I just changed to symbolize the what I was thinking, but thankyou for the heads up.

Well the idea is, the 'master' user is changed to non-member. This triggers a reset of his information, and also triggers the above action, resetting the members field for the other 'slave' members.
But as the member information is more than just a field, and I already have actions for fixing it all, it would be nice if the change in the field, would activate the other actions that triggers on that field change.
The other thing I could do, was to set the FamilyID to 1 (there is no user with id=1), as that is not a valid FamilyID, I could have a 'Users' trigger that just searched the that familyid, and then triggers all the appropriate actions. This will not remove the users as members immediately, but they would be removed next time the Users is run (it's run once a day).

Best regards
Fribse

Frømandsklubben Nikon, www.nikondyk.dk
We're a volunteer driven diving club in Ishøj, Denmark.
Har du brug for en dykkerklub der rummer alle, så kom ned til os.

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

  • fribse2011
  • fribse2011
  • OFFLINE
  • Posts: 921
  • Thanks: 79
  • Karma: 8
7 years 11 months ago - 7 years 11 months ago #291293 by fribse2011
Replied by fribse2011 on topic Managing family membership via auto-action?
BTW. just to be clear, I'm not using CBSubs (the club can't afford that, so the membership system is coded in autoactions :)

I just tried with the query, didn't work, darned.
I just entered this in the query box:

UPDATE `xxx_comprofiler` SET `cb_familyid` = '1' WHERE `cb_familyid` = '[user_id]' AND `id` != '[user_id]'

I also tried

UPDATE `#_comprofiler` SET `cb_familyid` = '1' WHERE `cb_familyid` = '[user_id]' AND `id` != '[user_id]'
UPDATE `#_comprofiler` SET `cb_familyid` = '1' WHERE `cb_familyid` = '[user_id]' AND `user_id` != '[user_id]'

I'm again missing something due to lack of experience with this :blush:

Best regards
Fribse

Frømandsklubben Nikon, www.nikondyk.dk
We're a volunteer driven diving club in Ishøj, Denmark.
Har du brug for en dykkerklub der rummer alle, så kom ned til os.
Last edit: 7 years 11 months ago by fribse2011.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48709
  • Thanks: 8319
  • Karma: 1447
7 years 11 months ago #291323 by krileon
Replied by krileon on topic Managing family membership via auto-action?

Well the idea is, the 'master' user is changed to non-member. This triggers a reset of his information, and also triggers the above action, resetting the members field for the other 'slave' members.
But as the member information is more than just a field, and I already have actions for fixing it all, it would be nice if the change in the field, would activate the other actions that triggers on that field change.
The other thing I could do, was to set the FamilyID to 1 (there is no user with id=1), as that is not a valid FamilyID, I could have a 'Users' trigger that just searched the that familyid, and then triggers all the appropriate actions. This will not remove the users as members immediately, but they would be removed next time the Users is run (it's run once a day).

Ok, so you're wanting the field action to fire after profile update trigger? I don't think I can safely add that at this point as everyone is using it with regards to it not doing that. However, every action fires a trigger of its own when the action is completed. Specifically autoactions_onAction. The variables for it are as follows.

$return, $trigger, $user

So you could have an action act on another action by using that trigger with the below condition.

[var2_id] Equal To PREVIOUS_ACTION_ID

I just entered this in the query box:

UPDATE `xxx_comprofiler` SET `cb_familyid` = '1' WHERE `cb_familyid` = '[user_id]' AND `id` != '[user_id]'

I also tried

UPDATE `#_comprofiler` SET `cb_familyid` = '1' WHERE `cb_familyid` = '[user_id]' AND `id` != '[user_id]'
UPDATE `#_comprofiler` SET `cb_familyid` = '1' WHERE `cb_familyid` = '[user_id]' AND `user_id` != '[user_id]'

Neither are valid queries. The prefix replacement is #__ (double underscore). The below will execute, but i'm not sure it makes sense.

Code:
UPDATE `#__comprofiler` SET `cb_familyid` = 1 WHERE `cb_familyid` = '[user_id]' AND `id` != '[user_id]'

You're conditioning off cb_familyid being the user id, but you're setting it to 1. Is that the reset usage to break the family subscription connection?


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.

  • fribse2011
  • fribse2011
  • OFFLINE
  • Posts: 921
  • Thanks: 79
  • Karma: 8
7 years 11 months ago #291350 by fribse2011
Replied by fribse2011 on topic Managing family membership via auto-action?
What I've done is that the familyid is set to the masterusers id.
So when the master user is resigned, I need to search the other users for the masterusers id in the familyid.
Setting it to 1 will 'tag' the familyid to something invalid, and then I can make a users action that runs through all the users looking at the familyid '1', and then resign them.
So in worst case the family members will be resigned 23 hours and 59 seconds after the master user, I think that is ok.
As I understand it, the autoactions are run in sequence, so if I place that 'invalid familyid' search action at the top, it should reach the user before any of the other 'users' actions, right?
Ahh, double underscore, hadn't noticed that, thankyou, I'll try it out!

Best regards
Fribse

Frømandsklubben Nikon, www.nikondyk.dk
We're a volunteer driven diving club in Ishøj, Denmark.
Har du brug for en dykkerklub der rummer alle, så kom ned til os.

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

  • fribse2011
  • fribse2011
  • OFFLINE
  • Posts: 921
  • Thanks: 79
  • Karma: 8
7 years 11 months ago #291354 by fribse2011
Replied by fribse2011 on topic Managing family membership via auto-action?
Hmm, I can't figure out what is going wrong.
I have an 'action' auto-action that activates all the sub-actions to resign the member properly.
If I disable all the actions, except the query action, it works as it should.
If I enable all the other actions, it doesn't work. I don't have 'reload user' set on any of the actions.

Best regards
Fribse

Frømandsklubben Nikon, www.nikondyk.dk
We're a volunteer driven diving club in Ishøj, Denmark.
Har du brug for en dykkerklub der rummer alle, så kom ned til os.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48709
  • Thanks: 8319
  • Karma: 1447
7 years 11 months ago #291385 by krileon
Replied by krileon on topic Managing family membership via auto-action?
If you've multiple actions altering the _users or _comprofiler tables (field actions or query actions, etc..) you probably need to set them to reload users otherwise the next action may never know of the previous actions changes and either overriding them or their conditions failing.


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.

Moderators: beatnantkrileon
Powered by Kunena Forum