Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pubDateFix (publication date / last-modified date)
#1
[Update: Now available for download in Extend]

This plugin changes the behaviour of GetSimple's page date field (pubDate), making it fixed, working like a real publication date (it will not change when you edit and save a page again).

You can also edit the date under page Options. (Very basic editor, no date picker and it doesn't warn if date entered is invalid, e.g. "2010-09-31", or "aaaa" -- it would save it as the current time.)

This plugin also adds a new field, lastUpdate, that works like GS's default pubDate (last saved/modified). You can display it with function get_page_lastupdate(), that works like GS's get_page_date()
Reply
#2
Carlos Wrote:This plugin changes the behaviour of GetSimple's page date field (pubDate), making it fixed, working like a real publication date (it will not change when you edit and save a page again).

You can also edit the date under page Options. (Very basic editor, no date picker and it doesn't warn if date entered is invalid, e.g. "2010-09-31", or "aaaa" -- it would save it as the current time.)

You can define the editing date[-time] format in the plugin's file.

This plugin also adds a new field, lastUpdate, that works like GS's default pubDate (last saved/modified). You can display it with function get_page_lastupdate(), that works like GS's get_page_date()

pubDateFix 0.1 beta: http://www.cyberiada.org/cnb/getsimple-p...ubdatefix/

Nice functionality, but I'm not sure if changing the meaning of a field is the best way to do it.

The I18N Custom Fields plugin does it the other way: it leaves the pubDate as is and automatically adds a new field creDate with the creation date. Also the I18N search plugin allows sorting by pubDate and creDate (if it exists).
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
#3
I see your point, but I don't agree that it's changing the meaning of the field. "pubDate" is widely used (RSS, etc.) as a posted/publication date, not as a last saved one. And get_page_date()'s meaning is generic. However it's true that it's changing the expected behaviour for both for those who know GetSimple.

Before developing this plugin, I had experimented making a similar (easier) one, that I have not released: PublicDate. The editable field was publicDate, to be called by function get_page_publicdate().

However, I thought it could be more interesting to be able to directly use the -let's call it- publication date with GS's own get_page_date(). Also, I liked seeing the publication date instead of the last-modified one in the Page Management list, without having to patch /admin/pages.php

Another advantage was that pubDate is indexed automatically by Mike's PagesXML plugin and future GS 3.1, useful for doing things like my dirty would-be plugin "Recent Pages".

Thanks a lot for your opinion. (What about others...?)

I may try to do something similar using creDate (I knew about that)... Though perhaps the best would be that GetSimple's core had a creation/publication date (like creDate -- no need to be editable, that can be done with plugins).
Reply
#4
Simple and good plugin, thanks Smile
Reply
#5
Would you mind providing an example of what would be placed in the template?

Apparently my brain is not working today :/

Something like:
Code:
<p>Updated on: <?php get_page_lastupdate($dateformat); ?> </p>


GS Community Edition with php8.x compatibility, new features and much more!  Support Me


Reply
#6
Replace $dateformat by a string using the same format as GS's get_page_date(), e.g.:
Code:
<?php get_page_lastupdate('Y-m-d'); ?>

Code:
<?php get_page_lastupdate('F jS, Y - g:i A'); ?>
Reply
#7
Gracias Carlos,

I new my brain wasnt working right.
Is it possible to have both a published date and an updated date, or does this replace the published date?


GS Community Edition with php8.x compatibility, new features and much more!  Support Me


Reply
#8
This plugin adds a new field, lastUpdate, that works like GS's pubDate did without the plugin (its value is changed everytime you re-save the page).

Use get_page_date() to echo the publication/post/public date, and get_page_lastupdate() to echo the last saved/updated date.
Reply
#9
This doesn't seem to be working properly for me.
I have in the template now:
Code:
<p>Published on <time datetime="<?php get_page_date('Y-m-d'); ?>" pubdate><?php get_page_date('F jS, Y'); ?></time><br>
                    Edited on <?php get_page_lastupdate('F jS, Y - g:i A'); ?></p>

In "data/pages/index.xml" I can see:
Code:
<pubDate>Wed, 02 Sep 2009 03:35:00 +0200</pubDate><lastUpdate>Sun, 28 Oct 2012 20:50:41 +0100</lastUpdate>

But on the page its self it only displays pubDate for both areas.


GS Community Edition with php8.x compatibility, new features and much more!  Support Me


Reply
#10
Ah yes. Will fix it, thanks for reporting.

[update] Edit pubdatefix.php line 51, change
Code:
if (isset($data_edit->lastUpdate)) {
by:
Code:
if (isset($data_index->lastUpdate)) {
Reply
#11
Thanks for the update, all is working properly now. Smile


GS Community Edition with php8.x compatibility, new features and much more!  Support Me


Reply
#12
PubDate Fix, version 0.2:
  • Functions get_page_lastupdate and return_page_lastupdate were not working as they should. (thanks @islander)
Reply
#13
PubDate Fix, version 0.3:
  • Date/time picker (for GS 3.1+) (jquery datetimepicker)
  • Field layout adapted for GS 3.0+ (this plugin was designed for GS 2.03)
  • Field label ("Publication Date") translated to many languages (i18n files included)
Reply




Users browsing this thread: 1 Guest(s)