If you go to Home » Administration » Structure » Content types. Choose Basic page, then the display settings tab. There is a checkbox "Display author and date information." that says "Author username and publish date will be displayed.". I would expect that with that checked it would show the date/time of the current revision published. But it is instead showing the date/time of the last revision created. I would not want to show Anonymous users a date/time for a revision of the page that they have no access to. It would be better just to show them the date/time of current revision (published).

Comments

RdeBoer’s picture

Assigned: Unassigned » RdeBoer

Hi JH81,
Thanks for your report. Makes sense. Will look at it when I address the next batch of mods.
Rik

RdeBoer’s picture

Hi JH81,

So investigated this a bit further. First there's a minor bug in D7 core in that it says "Display author and date information -- Author username and publish date will be displayed" when what it really is displaying is the date when the content was created.
The code responsible is in the node.module:

function template_preprocess_node(&$variables) {
  // ..
  $node = $variables['node'];
  $variables['date'] = format_date($node->created);
  // ...
  $variables['submitted'] = t('Submitted by !username on !datetime', 
      array('!username' => $variables['name'], '!datetime' => $variables['date']));
  // ...
}

Note, that this is a template function, which may be overridden in the theme that you use.
This is probably why you're seeing "it is showing the date/time of the last revision created".

If you are PHP savvy, have a look at your theme templates (.tpl.php files) and template functions. If not, let me know what theme you're using and I may download it and have a look for you.

Rik

RdeBoer’s picture

Title: Display author and date information setting displays date of last revision created instead of current revision (published) date » "Display author and date information" displays date of last revision instead of current revision (published) date
Status: Active » Postponed (maintainer needs more info)
jh81’s picture

Rik,

Thanks for taking a look at this. I am using the Mayo theme and I looked in the theme template files and it doesn't look like it is overriding the template function. I found the template_preprocess_node function in node.module and do see that it is displaying the created date. I would like it to show the published date but I don't see where Revisions stores that field. I see a [revision:created] field but that would seem to also show the created date. Having the published date stored and available would be useful here and in implementing Revisioning we have run into a few other situations were we would really find it useful to have that available (hint, hint). I also can't seem to find a core Drupal field that would show the published date. I see [node:created] -> the date the node was posted and [node:changed] -> the date the node was most recently updated. Any idea where I can find the published date?

John

RdeBoer’s picture

Hi John,
I installed the Mayo theme on my test site. The "Submitted by.... on ...." shows the creation date, just like the core themes.

It comes from the mayo/templates/node.tpl.php file, which contains the line <?php print $submitted; ?>. The $submitted variable corresponds to $variables['submitted'], see #2 in this thread. Like you I can't find any reference of this being overridden anywhere except in core's Garland theme, which reverses the order of date and author.

So.... I don't know what code where on your system outputs the date of the last revision.... Are you sure we're talking about the "Submitted by ...." text?

By the way the date and time that a node/revision is published is not stored anywhere on the database, only for each revision the date it was last modified. The changed date of the node is the last modified date of the latest revision.

Once you've sorted out what's going on your system you can print out the (creation) date of the current published revision by adding the code below to your theme's node.tpl.php. I've tried this on Mayo and it works (i.e it shows the date of the currently published revision, not of the yet to be published latest revision):

      <?php print $submitted . ", modified: " . format_date($node->revision_timestamp); ?>

It may be neater to separate out the date retrieval bit into a hook_process_node() function, which fleshes out $variables['current_revision_date'] so that it's available in node.tpl.php simply via <?php print $current_revision_date; ?>.

If you do this (change to node.tpl.php and optionally introducing the theme hook) in a subtheme then you don't have to reapply the change to the Mayo theme when a new version of Mayo comes out.

Here are a couple of links to article describing how you can create a subtheme. Will only take you a few minutes.
http://www.flink.com.au/tips-tricks/create-subtheme (for D7)
http://drupal.org/node/441088

RdeBoer’s picture

Category: bug » feature
Status: Postponed (maintainer needs more info) » Fixed

Not a bug in Revisioning... Workaround provided.

jh81’s picture

Rik,

That worked perfectly for the Mayo theme. Thanks for all your help!

John

RdeBoer’s picture

Status: Fixed » Closed (fixed)

Fix confirmed.