I am working on a very large site that only uses Workbench Moderation on some of the content types. I don't want workbench_moderation_buttons to override the form submit buttons unless the content type is using moderation. Here is a patch with a very simple check that revisioning == TRUE to prevent non moderated content types from being overridden.

Comments

mariacha1’s picture

Status: Active » Needs review
askibinski’s picture

I did something similar, but I wanted to keep the nice draft/publish button states, even when there is no workbench moderation used.

    ...
    $stateMachineNames = array_merge(array($currentState), array_keys(workbench_moderation_states_next($currentState, $user, $form['#node'])));
    
+    if (!isset($form['workbench_moderation_state_current'])) {
+        // this is a content-type which does NOT use workbench moderation.
+        // So, let's just show the 'draft' and 'published' buttons instead.
+        $stateMachineNames = array(
+            0 => 'draft',
+            1 => 'published'
+        );
+    } 

    if (count($stateMachineNames)){ // If any state is defined, and this user have access to them.
    ...
theodorosploumis’s picture

Actually, code from #2 allows users to Publish content event if they don't have Moderation permissions to do so.

That's because $form['workbench_moderation_state_current'] is null before content creation!

kepford’s picture

I believe this issue is resolved in https://www.drupal.org/node/2327553

if (!workbench_moderation_node_moderated($form['#node'])) {
    return;
  }
saltednut’s picture

Project: » Workbench Moderation Buttons

Moved to full project.

saltednut’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.