Skip to Content Skip to Menu

Reset a field every month using AutoActions?

  • OldLodgeSkins
  • OldLodgeSkins
  • OFFLINE
  • Posts: 119
  • Thanks: 5
  • Karma: 2
  • Add-ons
9 years 6 months ago #277305 by OldLodgeSkins
Reset a field every month using AutoActions? was created by OldLodgeSkins
Hi,

I am currently working on a new website where users will be able to request me to do a specific task for them - each user will be allowed to do a certain number of requests each month. So I'm thinking to have a CB field to hold this value, and each time a user requests something, I'll manually decrease it. That way I can also display that value in front-end.
That's the easy part. Now my question is, can I reset this field to its default value for all users at the beginning of every month? I'm suspecting this is something AutoActions can do... Correct?

Thanks.

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

  • OldLodgeSkins
  • OldLodgeSkins
  • OFFLINE
  • Posts: 119
  • Thanks: 5
  • Karma: 2
  • Add-ons
9 years 6 months ago - 9 years 6 months ago #277307 by OldLodgeSkins
Replied by OldLodgeSkins on topic Reset a field every month using AutoActions?
Ok, I must admit, I haven't used AutoActions in a long time...
I need to initialize that value during registration first. So this would use an AutoAction also.
My trigger I guess would be OnAfterSaveRegistration. The action would be to set my field to 10. And I shouldn't need anything else as far as the initial value is concerned... Correct?

Edit: ok that part is working just fine...
Last edit: 9 years 6 months ago by OldLodgeSkins.

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

  • OldLodgeSkins
  • OldLodgeSkins
  • OFFLINE
  • Posts: 119
  • Thanks: 5
  • Karma: 2
  • Add-ons
9 years 6 months ago #277311 by OldLodgeSkins
Replied by OldLodgeSkins on topic Reset a field every month using AutoActions?
There does not seem to be a trigger based on a date...
But maybe I could use the lastvisitDate field, compare that with the current date, and if the last visit was done the month before (or even before that), reset the field. If it was done during the current month, do nothing. What do you think of that option?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 49441
  • Thanks: 8467
  • Karma: 1465
9 years 6 months ago #277334 by krileon
Replied by krileon on topic Reset a field every month using AutoActions?
You'd need to use the Internal Users trigger, which fires the specific action on every user row. Next use a Field action and set the field value as needed. Now you need to trigger your action on a month by month basis using CRON. The URL for CRON can be found within CB Auto Actions > Parameters as "Internal Users URL" (right click and copy the address) or you can manually process every month if you don't want to use CRON.

Another option could be to act on the after login trigger to reset it on a user by user basis when they login. You'd probably need to do some date conditions on the last visit date or keep track of when they purchased tasks for you and compare against that date.


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: OldLodgeSkins

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

  • OldLodgeSkins
  • OldLodgeSkins
  • OFFLINE
  • Posts: 119
  • Thanks: 5
  • Karma: 2
  • Add-ons
9 years 6 months ago #277355 by OldLodgeSkins
Replied by OldLodgeSkins on topic Reset a field every month using AutoActions?
Ok thanks Krileon, I'll try the cron route... It's probably the best of the two.

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

Moderators: beatnantkrileon
Powered by Kunena Forum