--- revision_moderation/revision_moderation.module.stock 2009-12-16 22:18:07 -0800 +++ revision_moderation/revision_moderation.module 2010-06-21 17:34:29 -0700 @@ -79,6 +79,13 @@ function revision_moderation_settings() '#description' => t('With this option enabled, users with the "administer nodes" privilege will bypass the moderation system, and their revisions will be published immediately.'), ); + $form['revision_moderation_edit_latest_revision'] = array( + '#type' => 'checkbox', + '#title' => t('Always edit latest pending revision'), + '#default_value' => variable_get('revision_moderation_edit_latest_revision', 0), + '#description' => t('With this option enabled, when choosing "edit revision" for a specific revision on the list of revisions page, if user has a pending revision for this node, the latest pending revision will be edited instead of the selected revision.'), + ); + return system_settings_form($form); } @@ -177,7 +184,7 @@ function revision_moderation_nodeapi(&$n } // Get username for the revision rather than the original node. $revision_author = user_load($node->revision_uid); - drupal_set_message(t('You are currently viewing a revision of this post created on @date by !author.', array('@date' => format_date($node->revision_timestamp, 'small'), '!author' => theme('username', $revision_author))) . theme('item_list', $links)); + drupal_set_message(t('You are currently viewing revision !revision_id of node !node_id created on @date by !author.', array('@date' => format_date($node->revision_timestamp, 'small'), '!author' => theme('username', $revision_author), '!revision_id' => $node->vid, '!node_id' => $node->nid)) . theme('item_list', $links)); } elseif ($node->revision_moderation == 1 && !$teaser) { // Notify admin if a node has pending revisions. @@ -197,15 +204,20 @@ function revision_moderation_nodeapi(&$n case 'prepare': // If user has a pending revision for this node, load the latest version of // it instead. - if ($revisions = revision_moderation_get_node_pending_revisions($node->nid)) { - global $user; - foreach ($revisions as $revision) { - if ($revision->uid == $user->uid) { - drupal_set_message(t('Editing your latest revision, which is still pending moderation.')); - $node = node_load($node->nid, $revision->vid); - break; + $revision_moderation_edit_latest_revision = variable_get('revision_moderation_edit_latest_revision', 0); + if($revision_moderation_edit_latest_revision != 0){ + if ($revisions = revision_moderation_get_node_pending_revisions($node->nid)) { + global $user; + foreach ($revisions as $revision) { + if ($revision->uid == $user->uid) { + drupal_set_message(t('Editing your latest revision, which is still pending moderation.')); + $node = node_load($node->nid, $revision->vid); + break; + } } } + } else { + drupal_set_message(t('Revision !revision_id of node !node_id.', array('!revision_id' => $node->vid, '!node_id' => $node->nid))); } break;