Skip to Content Skip to Menu

Auto action trigger for all users of certain user group

  • rbuelund
  • rbuelund
  • OFFLINE
  • Posts: 565
  • Thanks: 40
  • Karma: 4
2 years 10 months ago #327794 by rbuelund
I need to trigger a piece of php code (for sending an sms) to all users in a certain user group. I have an auto action that works, but how do I trigger it for all users in a certain user group - the users have not yet logged in on the site, so the user cannot trigger the autoaction himself.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
2 years 10 months ago #327795 by krileon
Use the Batches feature for that. It lets you run a set of users based off pre-defined criteria through auto actions. So you'd first configure your auto action with Triggers set to None then make sure it works and sends you an SMS. Next toggle Allow Direct Access to No so it can no longer be directly accessed. Now configure your Batch usage to run that auto action. You can pre-filter the list of users it runs against using conditions or directly adding to the database query and it's recommended you do so there otherwise it will run against all your users.

Now you can either run the batch manually via its URL or setup a CRON wget or cURL task to run it on a schedule. It has built in batching functionality so it won't overload your server (e.g. run against 100 users then clear memory and run against next 100).


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.

  • rbuelund
  • rbuelund
  • OFFLINE
  • Posts: 565
  • Thanks: 40
  • Karma: 4
2 years 10 months ago #327796 by rbuelund
Ahhh that is sweet ! :-) Could you also tell me what I should set i the Batches Basis filter to hit all user that have not visited the site yet?
maybe lastvisitDate - empty ?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
2 years 10 months ago #327797 by krileon
Check the lastvisitDate for those users in _users then condition against that. For J3 it's probably set to 0000-00-00 00:00:00 so you'd just use Equal/Not Equal To that value for J3 and for J4 it's probably set to NULL so you'd use Is/Is Not Empty conditions for J4. Those filters directly add to the database query so your filters need to be ready to check against those SQL values.


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.

  • rbuelund
  • rbuelund
  • OFFLINE
  • Posts: 565
  • Thanks: 40
  • Karma: 4
2 years 10 months ago #327799 by rbuelund
Thank you

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

  • rbuelund
  • rbuelund
  • OFFLINE
  • Posts: 565
  • Thanks: 40
  • Karma: 4
2 years 10 months ago - 2 years 10 months ago #327825 by rbuelund
I have now tried to trigger the Auto action batch, but I get this error for all users when I activate debug:
Code:
:: Action 132 :: Condition 1-1 failed for user 77 with "[var3]" Equal to "1"

In the auto action which I am triggering, I am testing to see if the users CBSubs subscrioption is no longer active - but that seems to fail with the batch, as at least 8 users are not active - but all users get the Error above. Any idea ?

The same condition works perfectly on another auto action that is not triggered by batch byt by its own trigger, set to onCPayUserStateChange

Is this because the [var3] variable is comming from the onCPayUserStateChange trigger ? And how would I then test for no active CBSubs subscription when using a batch trigger ?
Last edit: 2 years 10 months ago by rbuelund.

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

Moderators: beatnantkrileon
Powered by Kunena Forum