Is there any way to show when a node was last updated. It shows who has created the node but I am looking at making it say who updated the node rather than who created it. I have multiple users who will be updating the same nodes so I would like it to print to the screen the user name of who was the last one to update the node. The timestamp works I just can't figure a way to show the last user to update the node.

I currently have it so when a node is displayed it shows at the top:
Last updated by Jeremy Caldwell on: 04/24/2007

Can someone please give help me out?

Here is the code I currently have in my node.tpl.php file.

   <?php if ($submitted) { ?>
    <span class="submitted">
        <?php
            print 'Last updated by ' . theme('username', $node) . ' on: ' . format_date($node->changed, 'custom', 'm/d/Y');
            if ($terms) {
                print ' | in ';
            }
        ?>
    </span>
    <?php } ?> 

Comments

jeremycaldwell’s picture

Sorry if I didn't make this clear enough but I was looking at getting it so that it prints to the screen the username of who last updated the node rather than who created the node.

I know you can do this manually when updating/editing a node but can this be done automatically for all nodes?

--
Jeremy Caldwell
www.eternalistic.net

Anonymous’s picture

Maybe the views module can help you?!

gpk’s picture

What I think you want is the author and mod date/time of the most recent revision. If you just want last update then $node->changed might do it. Otherwise you may need to use $revisions=node_revision_list(nid) and then having got the last $revision from the list do theme('username', $revision). Check out the revision-related functions at http://api.drupal.org.

TBH I'm not quite sure why theme('username', $revision) works since theme_username expects a user object as an argument. But if it works then no matter ... :-)

Good luck

gpk