Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
bradl Posted April 22, 2017 Posted April 22, 2017 I'm bumbling around trying to get a last-edited line to show by default on record display. The database is set up wiki-style and I want good visibility of when the last change was made and by whom. Members have 'ability to edit silently' turned off at group level. When I edit as admin I see a checkbox to 'Show that the message has been edited' — I guess I'd like the equivalent of having that checked by default for every user. If I log in as a test user it doesn't show any edits I make. I tried removing the conditional around this part of the display template, to no effect. {{if $record->editLine()}} <span class='ipsType_light ipsType_medium ipsType_reset'> ({lang="edited_lc"}) </span> {{endif}} The conditional in the editLine template seems to apply only to showing the reason. {lang="date_edited" htmlsprintf="\IPS\DateTime::ts( $record->record_edit_time )->html(FALSE), htmlspecialchars( $record->record_edit_member_name, ENT_QUOTES | \IPS\HTMLENTITIES, 'UTF-8', FALSE )"} {{if $record->edit_reason}} <br>{$record->edit_reason} {{endif}} Thanks for any tips.
Randy Calvert Posted April 24, 2017 Posted April 24, 2017 I don't have time to go look at this myself, but my first instinct is that you're looking in the wrong place. If the setting is to not log the event, editing the skin to always show the last edit date is not going to matter. You're not going to have any results to return to display there. Instead, I would look at the input form of the content or wherever is giving the user the option to uncheck the option to not log the edit.
bradl Posted April 24, 2017 Author Posted April 24, 2017 Good point. I looked at the 'form' template that the database uses but could not make sense of it. I'll look again with fresh eyes and maybe I'll spot the right place to experiment with.
opentype Posted April 24, 2017 Posted April 24, 2017 On 4/23/2017 at 1:04 AM, bradl said: If I log in as a test user it doesn't show any edits I make. I am not sure it’s even meant to do that.
bradl Posted April 24, 2017 Author Posted April 24, 2017 Possibly not, although that depends on what it you mean by "it's" By test user I mean an account I use that is assigned non-administrative regular permissions (that is, the same group as club members who would be editing the policy documents that make up this database). Viewing revision history shows the edits made by all users as expected. I'd like to make that last user/date slug available in the display template somehow.
opentype Posted April 24, 2017 Posted April 24, 2017 I had a custom code in 3.4 to list the recent contributors to a Wiki record. Haven’t looked into that for 4.x yet. There is nothing in the template normally that shows that. The edited line is just meant to show that an admin has made I change I think. It doesn’t show recent Wiki author.
opentype Posted April 24, 2017 Posted April 24, 2017 Okay, I had a look. I am not seeing the contributors in the record variable. But I do see the last edit, even if its not an admin. $record->record_edit_member_name $record->record_edit_member_id $record->record_edit_reason You can also construct the user link with photo from the ID.
opentype Posted April 24, 2017 Posted April 24, 2017 Works as described. Added it to one of my Wikis just to try it out. Very useful for a Wiki to acknowledge at least the latest editor.
bradl Posted April 24, 2017 Author Posted April 24, 2017 Perfect! Sorry to be dense — to help me learn to learn for future self-help, where did you look to find those available variables? (So that I may find the correct name for the date.)
clearvision Posted April 24, 2017 Posted April 24, 2017 I normally just do a print_r($record) to see what's there.
Duken Posted July 28, 2017 Posted July 28, 2017 On 24-4-2017 at 10:24 PM, bradl said: Ah, record_edit_time it is then. Thanks. I'm trying the same. This worked on but when an article is older then 7 days you het 1 jan 1970. How did you fixed this? Thank you
bradl Posted July 28, 2017 Author Posted July 28, 2017 I didn't fix it as it seems to be working as expected for me, as near as I can tell. This is the complete line I have: <p class='ipsType_right ipsType_light ipsType_medium ipsType_reset ipsPad_half'> Last edited by $record->record_edit_member_name ({datetime="$record->record_edit_time"})</p> which gives me the following (which works for my use-case). Last edited by Test Case (April 24)
Recommended Posts
Archived
This topic is now archived and is closed to further replies.