[SOLVED] Auto Action SQL queries

1 month 6 days ago - 1 month 5 days ago #316322 by thejungle
Can anyone help please?

I have created an Auto Action

Triggers: OnAfterUpdateUser
Type: Query
User: Automatic

Action:
UPDATE `a3f6h_comprofiler` SET `cb_pass`= NULL,`cb_passdetails`=" " WHERE cb_pass < CURDATE()

Nothing happens after updating a user. I know the command works as I've successfully executed it in php admin
1 month 6 days ago #316329 by krileon
The onAfterUpdateUser trigger only fires when a user is edited in backend. For frontend profile edit you need to use onAfterUserUpdate. Use both if you want your query executed in both locations. Your query is also editing every single user on your site and not just the user being updated; I suggest just using a field action or you need to become more familiar with the database before doing direct queries like that.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Templates - CBSubs - Hosting - Forge - Incubator - GroupJive
--
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 EST to 4:00 PM EST. 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.
1 month 6 days ago #316332 by thejungle
Thanks for this. It now works.

Our database has about 24500 members. About 250 of these have annual passes, so I need to check every day to see if their pass has expired and empty the 2 fields. Our customers rarely edit their profiles but we edit about 10-20 a day so this seemed a good way of purging the entire database. Not sure how I could just automate it to run once a day.
1 month 6 days ago #316335 by krileon

Not sure how I could just automate it to run once a day.

Set Triggers to None then setup a wget CRON task to run the auto actions URL found under the Global tab while editing the auto action. This will allow it to run daily or at whatever schedule you need. Since you are not using any user specific substitutions this will work fine and efficiently.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Templates - CBSubs - Hosting - Forge - Incubator - GroupJive
--
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 EST to 4:00 PM EST. 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.
The following user(s) said Thank You: thejungle
1 month 6 days ago #316336 by thejungle
Thanks, I've set this up and tested. Works perfectly.
The following user(s) said Thank You: krileon
Moderators: beatnantkrileon
Time to create page: 0.609 seconds

Facebook Twitter LinkedIn