-
- Downloads
Created the following User class methods to allow the atomic (safe) adjustment
of numeric/statistical user fields: * User.adjust_credits(count) * User.adjust_minutes(count) * User.posted_message([count=1]) * User.sent_email([count=1] [,feedback=false]) * User.uploaded_file(bytes [,files=1]) * User.downloaded_file(bytes [,files=1]) In the methods where "count" is optional (in square brackets), the default value is '1'. So to increment the user's messages-posted statistcs by one (for today and total), User.posted_message() is all that is needed. Specifying a negative value allows adjust downwards (subtraction). e.g. to remove 1000 credits: User.adjust_credits(-1000); The User.stats properties are *intentionally* read-only (i.e. not a bug) since there is no "safe" way to modify these properties using normal mathematical operators (e.g. +=), hence the need for these new methods.
Please register or sign in to comment