Adding a field in the users table is simple enough. Updating the entry when the user profile is saved is also simple. But, I'm not sure where I need to place this entry. I've reviewed the User.php file which looks promising, but the getPersonalDataFieldOptions function does not give me the anticipated results. The reason I'm adding this is because I don't want the user updating certain parts of their profile more often than a few days. This is to combat an account sharing problem. Users are changing data to suit themselves and doing as they please. I need to prevent daily changes to certain parts of the profile. Anyone know how to do this?
Hello, I assume your field is SQL. You can use the following code snippet in site.php file to record date and time of last edit: https://docs.amember.com/docs/Site_php_file PHP: Am_Di::getInstance()->hook->add([Am_Event::USER_BEFORE_UPDATE, Am_Event::USER_BEFORE_INSERT], function(Am_Event $e) { $e->getUser()->date_modified = sqlTime('now');}); I recommend to check if field (that you want to track) is actually changed. Best Regards.
Thanks for the reply Caesar. I will give that a try. In follow up to this, I have certain custom fields (SQL) in the user profile that I do not want to be updated more often than every few days. How/where would I add the "if" statement and return a notice to the user? Another option I have in mind is to simply lock the form fields on load unless the prescribed number of days has passed. Thank you.