I created a new additional profile input, that just an input that can take a text string, but I need the ability to make sure users can only update this field once in 24 hours. I see that i can write regex for string validation but where would i go about writing a validation method to make sure an input can only be updated within x amount of hours?
That should be something very hard to achieve...
The way the fields are stored is not compatible with any kind of "time-based" checking... I can't really imagine an easy way to do it without substantially change the current codebase...
Well, can't i just like loop the array of custom fields on profile save, find the one that matches, then check last updated time, if not return the user to the profile with an error?
I'm sure how the form data is saved currently.
How it works, you can find explanation here:
http://www.simplemachines.org/community/index.php?topic=518203.msg3666696#msg3666696
And there you can see that there is no real way to get the last modified time...
what if i created a new table that stored that information and checked against that?
Yup, that's a thought.
You need to basically duplicate the "themes" table structure, with an extra column to store the modified time, because it has no single "ID" like others
Lainaus käyttäjältä: margarett - helmikuu 07, 2014, 01:51:42 IP
That should be something very hard to achieve...
See what I mean? :P
You would think by default that you would have a last updated time for anything that a user can change.
You would think that storing that for the hundreds of possible values that a user can update, it would get very inefficient to store the last-updated time as well.