Auto Update Publication Date Time

36 views
Skip to first unread message

Philip Buckley

unread,
Feb 8, 2014, 7:46:39 AM2/8/14
to habar...@googlegroups.com
When someone edits a post I would like the publication date and time to be updated to the time of the edit. I know I can go into the "Settings" tab below the content entry area and manually change the publication time, but it would be quite nice if it happened automatically. Is there an easy way to achieve this?

Philip

Bryce Campbell

unread,
Feb 8, 2014, 10:05:10 AM2/8/14
to habar...@googlegroups.com

I do not think that would be a good idea.

It would be better if there was a little note in parenthesis that says updated at a certain point.

On Feb 8, 2014 4:46 AM, "Philip Buckley" <phi...@languageflow.com> wrote:
When someone edits a post I would like the publication date and time to be updated to the time of the edit. I know I can go into the "Settings" tab below the content entry area and manually change the publication time, but it would be quite nice if it happened automatically. Is there an easy way to achieve this?

Philip

--
--
To post to this group, send email to habar...@googlegroups.com
To unsubscribe from this group, send email to habari-dev-...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/habari-dev
---
You received this message because you are subscribed to the Google Groups "habari-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to habari-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Chris Meller

unread,
Feb 8, 2014, 1:51:54 PM2/8/14
to Habari Dev
I believe if you blank out the publish date it’ll get automatically set to the current time. That would probably be the easiest way to go about it, if that’s what you really want.

Do note though that we have three different timestamps. I’m not sure what your use case is, but there is a published, updated, and modified timestamp for every post. It may work better for you if you simply used updated or modified, rather than published, so there’s no extra step required.


Bryce Campbell

unread,
Feb 8, 2014, 1:54:47 PM2/8/14
to habar...@googlegroups.com

Learn something new every day. I did not know that the other two dates existed, but that definitely makes more sense than what I thought they wanted.

On Feb 8, 2014 10:51 AM, "Chris Meller" <ch...@doesnthaveone.com> wrote:
I believe if you blank out the publish date it’ll get automatically set to the current time. That would probably be the easiest way to go about it, if that’s what you really want.

Do note though that we have three different timestamps. I’m not sure what your use case is, but there is a published, updated, and modified timestamp for every post. It may work better for you if you simply used updated or modified, rather than published, so there’s no extra step required.


Chris Meller

unread,
Feb 8, 2014, 1:59:43 PM2/8/14
to Habari Dev
Yep. Updated is bumped any time it’s updated, I believe Modified is updated when the “minor edit” checkbox is not checked… Or vice versa. We really could not have picked more confusing, yet completely logical, names for those fields.

Christopher Davis

unread,
Feb 8, 2014, 2:11:23 PM2/8/14
to habar...@googlegroups.com
Also note monkeying with the publish date will have RSS feed implications.  

Sent from my iPhone

On Feb 8, 2014, at 12:59 PM, Chris Meller <ch...@doesnthaveone.com> wrote:

Yep. Updated is bumped any time it’s updated, I believe Modified is updated when the “minor edit” checkbox is not checked… Or vice versa. We really could not have picked more confusing, yet completely logical, names for those fields.

--

Bryce Campbell

unread,
Feb 8, 2014, 2:14:56 PM2/8/14
to habar...@googlegroups.com

That is what I thought would happen as well, though I thought that Habari did not have RSS, only ATOM, though I think I did see an RSS plugin one time.

Owen Winkler

unread,
Feb 8, 2014, 2:30:47 PM2/8/14
to habar...@googlegroups.com
I am the editor of an online magazine, covering the amazing activities
of Justin Bieber.

The Bieb has arrived for a vacation in Miami, and so I write a post
about how his favorite place to cruise is Miami, and publish it with a
couple of stock photos of Bieber 'shopped with Don Johnson. Habari
publishes the post and sets the Published, Updated, and Modified dates
all to the same value.

I then write a post about Justin Bieber's success in Germany, where he's
well known for his grasp of different languages, like German. Habari
publishes the post and once again sets this post's Published, Updated,
and Modified dates all to the same value. Because the *Updated* date is
after the one about Miami, this post appears after that one in any feed
that Habari publishes (Atom or RSS via plugin).

The next day, I find out that Justin has been arrested by the Miami cops
for speeding and coking up while driving. I decide to update that
existing article with this news (usually, I just add a bold "UPDATE:" to
the bottom of my post followed by the new content), and when I save it
with the minor edit checkbox *not* checked, the Published date stays the
same (since the date that I originally published the post is still
yesterday), and the Updated and Modified dates are set to the current
date and time. Because the Updated date of the Miami post is now
*after* the polyglot one, the Miami post shows up as the most recent
post in any feeds that Habari produces.

Later that day, I learn that Bieber doesn't really know German (or
indeed what "German" is) and decide to update that post to change all of
the references from "German" to "Canadian". I feel this is a minor
edit, not worthy of updating my news feeds, and so when I save the post,
I check the "Minor Edit" checkbox. When the post is saved, the
Published and Updated dates stay the same, but the Modified date is
changed to the current date, which causes it to appear at the top ("most
recently edited") of the list of posts in the admin, but doesn't affect
its order in the feed or on the home page. The post about Miami remains
the most recent thing I've updated in all feeds Habari publishes.

All three date values are available to the theme for display, and the
sort order that Habari uses for post output is generally based on the
value of the Updated field, although this is possible to change with
some code.

Owen

Philip Buckley

unread,
Feb 8, 2014, 3:19:29 PM2/8/14
to habar...@googlegroups.com
It's a community website with different people contributing content. One of the contributors has pointed out to me that when they make a change to an old post , the post doesn't show up in the list of "Latest Updates" on the home page (as they would like it to).

That list is a list of the 10 most recent posts ordered by 'pubdate DESC'. Looks as though I can simply change it to order by 'updated DESC' or 'modified DESC' to get the behaviour I want. Logically - if I have understood Owen's example correctly - I think it should be by 'updated DESC' but in the short term I might need to set it to 'modified DESC' because I am sure nobody will have thought to uncheck the "Minor Edit" checkbox. Where would I change what that checkbox defaults to? I think for my users it would be easier if it defaulted to unchecked.

Thanks for all the posts on this and the clarification of the different timestamps.

Philip

Bryce Campbell

unread,
Feb 8, 2014, 3:26:20 PM2/8/14
to habar...@googlegroups.com

Not sure where the default is, but if you go into the settings while editing a post, you can uncheck it. The only thing I can say for sure though is that you would probably need to know PHP, because you would need to either manipulate the loop used for posts or make something in the sidebar.

Chris Meller

unread,
Feb 8, 2014, 5:04:58 PM2/8/14
to Habari Dev
In order to change the default you would need to create a plugin that implements the publish_form action plugin hook.

The post form is generated in system/classes/post.php. The minor edit checkbox is added to it on line 1052 [1] and then the form is handed to the plugin hook on line 1128 [2], where you can see what the hook receives.

At least, those are the line numbers for 0.10, in 0.9 they would vary a bit. I know the MetaSEO plugin (in -extras) modifies the post form by adding another tab next to “Settings”, so it might help you in creating the plugin you need. FormUI syntax has changed since 0.9, so watch out for that.


Chris Meller

unread,
Feb 8, 2014, 5:07:03 PM2/8/14
to Habari Dev

On Feb 8, 2014, 2:30:47 PM, Owen Winkler <epi...@gmail.com> wrote:
>I am the editor of an online magazine, covering the amazing activities
>of Justin Bieber.

Where can I subscribe to this magnificent, and apparently very comprehensive, publication?

Randy Walker

unread,
Feb 8, 2014, 5:07:53 PM2/8/14
to habar...@googlegroups.com
+1

-- 
Randy Walker
--

Chris Meller

unread,
Feb 8, 2014, 5:10:01 PM2/8/14
to Habari Dev
Also, I recommend this explanation become a wiki page to explain how all that works, since we have this question come up surprisingly frequently.

John Edmondson

unread,
Feb 8, 2014, 6:23:44 PM2/8/14
to habar...@googlegroups.com

+1 As even after a good pub meal and some beers this made sense.

On 8 Feb 2014 22:10, "Chris Meller" <ch...@doesnthaveone.com> wrote:
Also, I recommend this explanation become a wiki page to explain how all that works, since we have this question come up surprisingly frequently.

--

Konzertheld

unread,
Aug 25, 2014, 1:33:40 PM8/25/14
to habar...@googlegroups.com
I added an explanation and a link to Owen's post here: http://wiki.habariproject.org/en/Date_and_time

For the record, the Bieber example only works for the feed. Most themes (including the default ones) do not sort by updated but by pubdate.
Reply all
Reply to author
Forward
0 new messages