Okay
  Public Ticket #1514753
Last Update User & Date columns
Closed

Comments

  • Daniel started the conversation

    I need to be able to create an audit trail of who did the last update on a row in a MySql table.

    Given MySql table with cols

    id    INT
    Data   TEXT
    lastUserUpdt    DATETIME
    lastUserId    INT

    When a row from this table is inserted, or updated, can I configure wpDataTables to auto-update the last two fields with today's datetime, and userid?  And can I hide the last two fields so they are not enterable by the user?

  • [deleted] replied

    Hi Daniel,
    Thank you for your inquire.

    Best way to do this whould be with hooks. You will need to write little function which will be triggered whenever row is edited in frontend and write desirable data in fields which are not included in table.

    List of all hooks can be found in our - Documentation and for this case I think that wpdatatables_after_frontent_edit_row would be most appropriate. This action fires after every frontend editing. 

    For columns that you need to prevent users for changing simply choose none for editor in the column settings 

    For testing purpose we have sandbox website where you can see and test all plugin functionalities

    sandbox.wpdatatables.com

    username: demo

    password: demo


  • Kinnari Ajmera replied

    Can someone please explain this further? Where exactly can I call this hook?