Skip to Content Skip to Menu

🌟Discover the Joomla AI Plugin that wrote its own story! - CB Editor Assistant 1.1now for Joomla 3, 4 & 5!
✍️ 5-Day Free Trial, then 🎯 save up to 30% with our 🛍️ Intro Offer (First 50 users, ends Dec. 31)
🌲 Merry Christmas! Great savings on Professional and Developer Memberships! Get 25% off now with code XMAS-2024!

[SOLVED] How do I run script to activate auto-actions?

  • fribse2011
  • fribse2011
  • OFFLINE
  • Posts: 921
  • Thanks: 79
  • Karma: 8
9 years 11 months ago - 9 years 11 months ago #255949 by fribse2011
Hi Guys

I have a problem around new-years. When people exit our club, we have so far manually remembered them, and then on the 1/1 we've discontinued their membership.
It is working, but not nice of course.

Also, as we start sending out automatic emails from 1/10 to remind to renew, some people are getting confused, because they've sent a message that they have signed out.

The automatic mail reminders are set in a field called rykker (checkmark).
The value is set to 1 by an "activate" SQL sqript run from cron once a day. It would be nice to be able to do it via an auto-action, but I haven't found a way to call and auto-action scheduled, and go through all the members.

If payment is received and entered for the user two auto-actions first sends a mail, and then sets the 'rykker' to 0, thus deactivating the mail reminders.

So now I've created a new field, called 'udmeldt'. This makes the "activate" script not activate the mail reminders, if users have said that they wish to discontinue the membership.
So far so good.

Now, I would like to create an sql script to be run on the 31/12 in the last minute, to mark all 'udmeldt' members as discontinued.
The script itself is working, but I would like to make an auto-action send out a mail when it modifies a users membership status.

Do you have any ideas for how to do that?

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: 9 years 11 months ago by krileon.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48630
  • Thanks: 8307
  • Karma: 1446
9 years 11 months ago #256133 by krileon
Replied by krileon on topic How do I run script to activate auto-actions?
CB Auto Actions has 3 ways of directly executing an action. Internal General, Internal Users, or Internal Action. The way they're used is you need to edit your action, give it the Internal Users trigger, then navigate to CB Auto Actions > Parameters and you'll find a link to process the Internal Users actions. This will fire all actions with that trigger on every CB user row.

You can use the URL in CRON, etc.. Internal General functions the same way except it has no user object and can be used for general processing. You can directly fire an action from the URL found while editing an action, but it will not have a user object unless a user id is specified in the URL with &users.

So in your case you'd have the Internal Users trigger for a CBSub Action to unsubscribe them from the specific plan. Next you'd setup CRON to run it on the specific day. As a double safe guard you may want to add a Condition to the action to make sure the date is correct as well, which is done with the following.

strtotime([cb:date format="Y-m-d" /]) Equal To strtotime([cb:date format="Y" /]-01-01)


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
9 years 11 months ago #256179 by fribse2011
Replied by fribse2011 on topic How do I run script to activate auto-actions?
Excellent, thankyou for your help!

So I've created two actions so far.
Both are for 'Member' access(an ACL level above Registered).

First action sends an email that the user is now no longer a member.
Second action replaces the groups with Registered.

Now I need the last action to clear the 'udmeldt' field.
I was thinking that if the user is Registered, and has the 'udmeldt' field, I can set the udmeldt field to '0', but if I set the Access of the rule to 'Registered' will it then also be valid for the higher level 'Member'?

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
9 years 11 months ago #256209 by fribse2011
Replied by fribse2011 on topic How do I run script to activate auto-actions?

krileon wrote: CB Auto Actions has 3 ways of directly executing an action. Internal General, Internal Users, or Internal Action. The way they're used is you need to edit your action, give it the Internal Users trigger, then navigate to CB Auto Actions > Parameters and you'll find a link to process the Internal Users actions. This will fire all actions with that trigger on every CB user row.

Not sure what is meant here. I don't see a 'Parameters' in the AutoAction overview, and if I look under parameters in the individual rule, I don't see any URL either.
I do see a link 'Internal Action URL' under the Global in the rule, is that what is meant?
Is there a way to 'secure' it a bit, so that an extra key is needed on the URL, and the rule can't just executed for a user without that?

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: 48630
  • Thanks: 8307
  • Karma: 1446
9 years 11 months ago - 9 years 11 months ago #256263 by krileon
Replied by krileon on topic How do I run script to activate auto-actions?

I was thinking that if the user is Registered, and has the 'udmeldt' field, I can set the udmeldt field to '0', but if I set the Access of the rule to 'Registered' will it then also be valid for the higher level 'Member'?

Set the field before or after sending your email. Then do the usergroup change. Your usergroup change ideally should always be last.


Within CB > Plugin Management > CB Auto Actions > Parameters you'll find the Internal General and Internal Users links to process actions with those triggers. They can be used for CRON or you can just run them manually. The links are secured with a secret code and will only execute if the secret is present and valid.

I do see a link 'Internal Action URL' under the Global in the rule, is that what is meant?

That's 1 of the 3, yes. That runs that particular action only. It does not run it for every user though. What you need to use is Internal Users URL while your actions have the Internal Users trigger.


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: 9 years 11 months ago by krileon.

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

  • fribse2011
  • fribse2011
  • OFFLINE
  • Posts: 921
  • Thanks: 79
  • Karma: 8
9 years 11 months ago #256305 by fribse2011
Replied by fribse2011 on topic How do I run script to activate auto-actions?
Ahh, ok, now I get it, it isn't in the auto-actions overview, it's in the plugins parameters, silly me.

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.

Moderators: beatnantkrileon
Powered by Kunena Forum