You are here

function revisioning_get_last_editor in Revisioning 6.3

Same name and namespace in other branches
  1. 8 revisioning_api.inc \revisioning_get_last_editor()
  2. 7 revisioning_api.inc \revisioning_get_last_editor()

Get the id of the user who last edited the supplied node, ie. the author of the latest revision. This is irrespective of whether this latest revision is pending or not, unless TRUE is specified for the second argument, in which case the uid of the creator of the current revision (published or not) is returned.

Parameters

$nid: The id of the node whose most recent editor id is to be returned.

$current: Whether the uid of the current or very latest revision should be returned.

Return value

A single number being the user id (uid).

1 call to revisioning_get_last_editor()
revisioning_handler_field_node_last_editor::render in views/revisioning_handler_field_node_last_editor.inc

File

./revisioning_api.inc, line 171
API functions of Revisioning module

Code

function revisioning_get_last_editor($nid, $current = FALSE) {
  $sql = $current ? "SELECT vid FROM {node} WHERE nid = %d" : "SELECT MAX(vid) FROM {node_revisions} WHERE nid = %d";
  $vid = db_result(db_query($sql, $nid));
  return db_result(db_query("SELECT uid FROM {node_revisions} WHERE vid = %d", $vid));
}