Jump to content

Force 'edited' line on Pages record?


bradl

Recommended Posts

Posted

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. 

Posted

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.  

Posted

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.

Posted

Possibly not, although that depends on what it you mean by "it's" :p 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.

All_Revisions_for__Judges_Selection_Process__-_Columbia_River_Cairn_Terrier_Club.png.412bb453bf851b8e1a12b8d46133bf4f.png

Posted

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. 

Posted

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. 

Posted

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.)

  • 3 months later...
Posted
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

Posted

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)


 

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...