It would be nice to be able to toggle on/off a "last edited on _date_" tag to the end of the "submitted by _user_ on _date_" line at the top of nodes. Somewhere I found a hack for adding this (though not as a configurable option) to xtemplate themes, and recently adapted it to work with PHPTemplate. I'm not really a programmer and don't know how to do patch submissions, but here is what you need to change on the phptemplate.engine file:
1) Beginning around line 280 under "function phptemplate_node" insert this:
$last_edited = '';
if ($node->created != $node->changed)
{
$last_edited = t(' | Last edited on %a',
array('%a' => format_date($node->changed)));
}
2) Then just below the newly inserted code, change this:
$vars['submitted'] = t('Submitted by %a on %b.', array('%a' => format_name($node), '%b' => format_date($node->created)));
}
to this:
$vars['submitted'] = t('Submitted by %a on %b.', array('%a' => format_name($node), '%b' => format_date($node->created))) . $last_edited;
}
3) Voila! If your node has been edited after its original submission date, the submission line should now include a "last edited on _date_" segment.
Unfortunately, I couldn't find where I found this original hack for Xtemplate, so I can't credit the source. It required only slight modifications to work with PHPTemplate.
It would be nice to have this built into PHPTemplate as an option that could be toggled on or off via the theme config page.
| Comment | File | Size | Author |
|---|---|---|---|
| #28 | node_revision_9.patch | 5.31 KB | shouchen |
| #25 | node_revision_8.patch | 5.94 KB | shouchen |
| #19 | node_revision_7.patch | 5.9 KB | shouchen |
| #15 | node_revision_6.patch | 4.16 KB | shouchen |
| #13 | node_revision_5.patch | 2.98 KB | shouchen |
Comments
Comment #1
morbus iffPHPTemplate is part of core in 4.7. Moving.
Comment #2
shouchen commentedHere is a patch that accomplishes everything you asked for, including the ability to toggle on and off the display of the "Last revised" time. I changed the term from "Last edited" to "Last revised" because the $node->changed is only updated when you create a new revision.
This is my first Drupal patch that actually changes the way the code functions. Take it easy on me....
-Steve
Comment #3
shouchen commentedScreen shot because of change to GUI
Comment #4
shouchen commentedUpdated patch because system.module changed slightly today in HEAD.
Comment #5
shouchen commentedCould this be considered for 4.7? The changes are very simple.
Comment #6
shouchen commentedUpdated patch
Comment #7
rkerr commentedI'd like to see this feature. Haven't tested the patch myself yet though :)
Comment #8
shouchen commentedPLEASE USE THIS PATCH INSTEAD OF THE ONE I UPLOADED A FEW MINUTES AGO
Comment #9
shouchen commentedDrupal Developers,
Could we get this very simple, yet useful, feature into 4.7 before the release candidate is released and it is too late for new features?
Thanks... -Steve
Comment #10
shouchen commentedUpdated patch to include recent change to node.module
Comment #11
shouchen commentedPlease also see http://drupal.org/node/41973
Comment #12
shouchen commentedCleaner code in the modification to node.module
Comment #13
shouchen commentedModification to node.module no longer needed, already committed to HEAD because of http://drupal.org/node/41973
Comment #14
Tobias Maier commentedI reviewed your code a little bit
here are my thoughts:
do it the way it is done for $taxonomy (under this piece of code)
means with else {}
looks better and is clearner
$last_revised = t(' | Last revised on %a.',fist
|is something which belongs to a themesecond what if I want to print the "last revised"-part on another place as the submitted-variable?
It would be much cleaner if you would insert a new variable
Comment #15
shouchen commentedTobias,
I think I understand what you mean... please review my latest patch.
Thanks,
Steve
Comment #16
shouchen commentedComment #17
shouchen commentedThis is only supported for PHPTemplate themes, but the options are displayed for all themes. Is that an issue? If so, how do I get around that?
Comment #18
shouchen commentedShould be easy enough to add to chameleon (XTemplate) theme... I'll work on that.
Comment #19
shouchen commentedNow the patch also works with the chameleon theme. Please review... thanks!
Comment #20
shouchen commentedRequesting code review, please. I think I've made all of the suggested changes. Thanks!
Comment #21
Crell commentedApplies cleanly for me, does what it claims, doesn't seem to break anything for me. Sending this upstairs to the big people. :-)
Comment #22
shouchen commentedLooks like the big people upstairs might not have noticed the delivery... :-)
Comment #23
shouchen commentedPlease consider this contribution for 4.7 -- thank you.
Comment #24
JPV commentedPlease consider adding this to 4.7! The lack of this drives me nuts (http://drupal.org/node/28434). I could not possibly care less when a node was created, I want to know the last time somone maintained (edited) it. I can't believe something so fundamantal is missing from such a great product. Am I just missing something? This patch seems to show I'm not, but...
Comment #25
shouchen commentedUpdated patch file because of some recent changes to applicable files.
Comment #26
shouchen commentedPlease consider this feature for 4.7... thanks.
Comment #27
drummI think the current "Display post information on" is more readable than "Post submission information display." The new setting should have a simple title to match.
Otherwise looks okay.
And it is not necessary to add useless comments every week.
Comment #28
shouchen commenteddrumm,
The code in system.module had changed somewhat since I first created the patch. I've updated the patch so it can be applied to the current CVS HEAD cleanly (and to DRUPAL-4-7 with some "fuzz" and "offsets"). I've also changed some of the wording per your suggestion. Please review - thanks! -Steve
Comment #29
Crell commentedI'm fairly certain a patch this old would need to be redone, but I'd still like to see it make it in.
Comment #30
Freso commentedSubscribing as I'll happily review the code when it gets updated, but I don't see meself having the time for this soonishly.
Comment #31
panchoDamn, this would have been great! Still it's too late for new features. Let's make D7 the best Drupal ever... :)
Comment #32
lhtown commentedOh, I do hope something like this is going into Drupal 7! The ability to change "submitted on" to "last updated on" would be perfectly marvelous.
Comment #33
sun.core commentedComment #34
valthebald1. Probably current setting should be split to 3, not 2:
a) Display author
b) Display created date
c) Display updated date
2. Should variable_get() be replaced with CMI configuration?
Comment #35
joelpittetThis can be done using the theme_settings toggle still in D8. Very similar to the last patch.
Your node.html.twig template.
If you feel this feature would be helpful still please re-open for 8.1.x feature but I think we have enough that if this is needed contrib or custom module/theme could solve this in a snap.