danielbidala VIP
Total posts: 153
17 Oct 2014 20:10

Hello

How to display the user name who last modified the record in custom record view template?

Thanks for help in advance

Last Modified: 20 Oct 2014


pepperstreet VIP
Total posts: 3,837
18 Oct 2014 01:25

Do you mean record's author/owner? Or any user who is allowed to edit the record?


danielbidala VIP
Total posts: 153
18 Oct 2014 05:58

I mean display the user name who last modified the record. (It's different from the author.)


pepperstreet VIP
Total posts: 3,837
19 Oct 2014 22:07

danielbidala user name who last modified the record. (It's different from the author.)

I guess, this information is not stored with the record data.

AFAIK, you would have to enable Audit Log feature in your type. You may add only necessary event notifications i.e. "edit". Then you have to add a respective SQL query into your custom template. Quick and dirty logic:

  • get user_id from
  • table "js res audit log"
  • where record_id = current record ID
  • where event type is "2" (it is the edit event, I believe)
  • order by ctime DESC (to get the latest event)
  • limit to 1

Then...

  • if no result, take Author name or display any other notice.

  • if result, fetch user name with user_id from query. (with help of Cobalt CommunityHelper)


pepperstreet VIP
Total posts: 3,837
19 Oct 2014 22:33

pepperstreet

danielbidala user name who last modified the record. (It's different from the author.)

I guess, this information is not stored with the record data.

@Sergey

Maybe this "editor" info could be part of the record table? I have seen there are also similar columns for "who repost", "reposted by". Or should it stay with Audit Log?


Sergey
Total posts: 13,748
20 Oct 2014 08:22

pepperstreet Or should it stay with Audit Log?

It i possible to add column for last editor to records table. May be even good, so you do тещ need to do any additional queries. But change is not for now.

Powered by Cobalt