We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22797
    • 134 Posts
    I’ve recently run into the need to be able to determine when specific template variable values are updated (not just the document they’re contained in). There is no built-in way to do this, as far as I can tell.

    The table modx_site_tmplvar_contentvalues has only these fields:

    • id
    • tmplvarid
    • contentid
    • value
    I would like to suggest adding another field: "editedon" (or "last_updated" or "timestamp" or something along those lines).
    I may end up adding it myself, but of course it won’t be part of the core that way.
      • 22303 MODX Staff
      • 10,725 Posts
      Upcoming releases will have a full set of audit metadata for any and all user-editable objects (i.e. Documents, Snippets, Chunks, TVs, Plugins, Modules, etc.), but this will be externalized, in separate tables, and is directly related to the versioning concepts that will accompany these changes. In addition to being relevant to versioning, this will also address the problem of TV’s only having a record if the value is different than the default (and resetting it to default deletes the row), as well as to reduce the impact of the audit data on SQL access when it is not relevant (i.e. keeps the TV or other source table compact and efficient).

      I would suggest adding a separate table that tracks whatever additional data you want by templatevar id and content id, and you will protect your upgrade path while still achieving what you need to. You can then use plugins to make sure that data is created, updated, or loaded when appropriate in the front-end and back-end.
        • 22797
        • 134 Posts
        I appreciate the response. I’ll probably end up creating another table, as you suggested.