Support Forum

show number and date/time of last edits

OV ovizii
ovizii
Member

the pre v5. themes where showing the number of times a post had been edited as well as the name of the user who did the editing and the date/time when it was last edited.

 

this is important in an older thread, where one would go end edit the first psot in a thread to update or correct so people looking at a long thread would immediately see that a psot was edited/by whom/when 

 

since I am currently trying to modify/customize the css-only theme (a copy of it that I renamed) I’d like to know what php code snippet I need to show that.

12 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

IF a post has been edited then it should show up as a little pencil icon beside the post number. We used to get many complaints about showing the information within the post so moved it to a popup. Do you not see this?

OV ovizii
ovizii
Member

I found it. An way to get it back as it was? My users are asking for this feature 🙁 

I searched your code and couldn’t find a function that outputs this info (the editing history) is there one?

MP Mr Papa
Mr Papa
Member

in the topic view functions, the template tag is sp_PostIndexEditHistory()…  

so find that template tag call in the spTopicView.php template file…  and then replace it with your code to display the edit history…  $spThisPost->edits contains the data and you can look in the current template tag for how to handle the data…

OV ovizii
ovizii
Member

can I ask you for more help? I suck at this 🙁 I can do some basic php editing meaning I can fiddle with wordpress plugins and themes but these SP themes look a bit different to me. 

 

original theme code snippet:

 

sp_SectionStart(‘tagClass=spPostContentSection’, ‘content’);
sp_PostIndexContent(”, __sp(‘Awaiting Moderation’));
sp_SectionEnd(”, ‘content’);

 

say I wanted to output the text you see when you click the view edit history button straight before this line: sp_SectionEnd(”, ‘content’); what code would I need to insert there? I think it is an array, containing those edits, but I have no idea how to output its contents 🙁

YS Yellow Swordfish
Yellow Swordfish
Member

You know something. Both Steve and I have been stupid here! I just checked the code – which I should have done when you first asked – only to find that I had already coded this to be displayed the old way if required!

Fine the call to sp_PostIndexEditHistory() in your topic template and add the argument ‘&popup=0’.

Of course you will need to move the position where that function is called to get it out of the post ‘icon’ section and into the ‘content’ section.

YS Yellow Swordfish
Yellow Swordfish
Member

Great.
Off though. I was smart enough to code it that way and yet dumb enough to forget I had done it!

OV ovizii
ovizii
Member

sorry, one last question: the current code:

 

sp_PostIndexEditHistory(‘tagClass=spButton spLeft&popup=0’, ”, __sp(‘<span class=”edited”>Edited by %USER% on %DATE% </span>’), __sp(‘View edit history’));

 

does show all edits. can I modify it to show only the last edit?

MP Mr Papa
Mr Papa
Member

:faceplant:

forgot myself we had allowed the option for not in popup…

I do not see a way to limit the info to the last edit…  looked at code this time wink

I know we used to do that, so we should probably support it now too…  but it should be doable without an explicit template tag argument…

problem for me now is I cannot get it to show (or save) more than the last edit…  so need to do some research…

MP Mr Papa
Mr Papa
Member

okay, there was a bug with saving of post edit history…  have corrected that…

while in there, I modified the template tag so you can specify the number of history to show…  just add count=x where is the number… 0 means all and is the default…

PA patrick182
patrick182
Member

Is there a way to delete the edit history in the sp-admin? I don’t mean delete the pencil icon, I mean, start from scratch with the edit list when you click on the pencil icon. Thanks.

YS Yellow Swordfish
Yellow Swordfish
Member

We have no tool as such that can do this currently. It is something I can add to the long lost of requests although as the only user to ask – as far as I am aware – it would take a low priority.

It would take a simple sql query to clear that data if you wanted to do it at the database level.