Skip to Content Skip to Menu

set Timeout element

  • galanopd
  • galanopd
  • OFFLINE
  • Posts: 374
  • Thanks: 49
  • Karma: 8
2 years 8 months ago - 2 years 8 months ago #328200 by galanopd
set Timeout element was created by galanopd
Using AutoAction, I need to disable element for 24h. I have tried various triggers like onBeforeUserProfileEditDisplay and even onAfterUserProfileSaved but no matter what I choose when the user edits profile again, he can change the value of the element before time set expires. Is there a way to keep the setting to disable until 24h have passed?
Code:
$('[name="cb_emailoptions_type"]').on('click', function() { if ($(this).val() === 'hours') { alert("You have chosen hours"); if (confirm("Do you really want this ?")) { $('[value="hours"]').prop('checked', true); setTimeout(function() { $('[name="cb_emailoptions_type"]').prop('disabled', false); }, 86399000); } else if (confirm != true) { $('[value="days"]').prop('checked', true); } } });
Last edit: 2 years 8 months ago by beat.

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

  • krileon
  • krileon
  • OFFLINE
  • Posts: 48419
  • Thanks: 8274
  • Karma: 1443
2 years 8 months ago #328204 by krileon
Replied by krileon on topic set Timeout element
That's just a JS timeout. That's not going to have any impact once they navigate away from the page and it won't prevent saves server side and should be considered entirely cosmetic.

If you want a 24 hour lock on a field you'll need to use something like CB Conditional (be sure to set Reset to Disabled) and have an actual condition to block editing of the field. You can use a Code condition type to write custom PHP to check against last visit date or last update date and see if its been 24 hours since they last logged in or last updated, but ideally for this to work best you'll want to keep track of when that individual field was updated.


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.

  • galanopd
  • galanopd
  • OFFLINE
  • Posts: 374
  • Thanks: 49
  • Karma: 8
2 years 8 months ago #328210 by galanopd
Replied by galanopd on topic set Timeout element
Is the last modified date of a field stored somewhere in the database?

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

  • krileon
  • krileon
  • OFFLINE
  • Posts: 48419
  • Thanks: 8274
  • Karma: 1443
2 years 8 months ago #328212 by krileon
Replied by krileon on topic set Timeout element
No, we don't keep track of individual fields modify dates. You'd need to implement that yourself using a custom database table and CB Auto Actions. Use the below to have an auto action act on field value change and is when you'd insert/update that database table. You can then use a Query condition to query for its update date.

Global
Triggers: onAfterUserUpdate
User: Automatic
Access: Everybody
Conditions
Field: Custom > Value
Custom Value: [var1_FIELD_NAME]
Operator: Not Equal To
Value: [var3_FIELD_NAME]

Replace FIELD_NAME with the name of the field you want to check has changed. The triggers used only applies to frontend profile edit. If you want to cover frontend/backend registration and frontend/backend profile updates you can use the below triggers.

onAfterUserRegistration, onAfterNewUser, onAfterUserUpdate, onAfterUpdateUser


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.

Moderators: beatnantkrileon
Powered by Kunena Forum