[SOLVED] Auto Action SQL queries

4 years 2 months ago - 4 years 2 months ago #316322 by thejungle
[SOLVED] Auto Action SQL queries was created 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

Please Log in to join the conversation.

4 years 2 months ago #316329 by krileon
Replied by krileon on topic Auto Action SQL queries
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 - 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 to join the conversation.

4 years 2 months ago #316332 by thejungle
Replied by thejungle on topic Auto Action SQL queries
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.

Please Log in to join the conversation.

4 years 2 months ago #316335 by krileon
Replied by krileon on topic Auto Action SQL queries

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 - 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.
The following user(s) said Thank You: thejungle

Please Log in to join the conversation.

4 years 2 months ago #316336 by thejungle
Replied by thejungle on topic Auto Action SQL queries
Thanks, I've set this up and tested. Works perfectly.
The following user(s) said Thank You: krileon

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.200 seconds

Facebook Twitter LinkedIn