[wp-hackers] usermeta revisions?

Alex Hempton-Smith hempsworth at gmail.com
Wed Jan 25 18:28:02 UTC 2012

Hi all,

I'm developing a membership system built on WordPress, which uses the
wp_usermeta table for adding all of the extra data assigned to users
(address, phone etc).

A problem I'm considering, is how to 'Undo' edits made to users, and how I
could possibly browse the revisions made to a users profile data over time
(and who made those changes).

The solution I've come up with is to save 'revision' entry to the usermeta
table, with a serialised array of all of the user data, along with the
timestamp of the revision, ID of the user who made it, and a list of the
modified fields. Something like:

$revision = array(
  'timestamp' = 2012-01-20 23:41:27,
  'revised_by' = 123,
  'first_name' = 'John',
  'last_name' = 'Doe',
  'user_email' = 'hello at example.com',
  'modified_fields' = array( 'first_name', 'user_email' );

Which I could then use to compare revisions etc.

Does anybody have any suggestions for how this could be achieved in a
better way perhaps?

- - - -
Kind regards,
Alex Hempton-Smith


More information about the wp-hackers mailing list