I have the latest versions of revisioning and module grants installed. I also have workflow installed and the access control module for workflow running. And now, I have discovered that I cannot unpublish nodes. If I go into a node to unpublish, I get the message that the node has been published and instead of showing me a node view, they show me the revision menu that you get when you want to view/edit/revert to a revision. I uninstalled the module, or rather de-activated it to see if it was the revision module causing the issue but, even with the module uninstalled, I still see the revision tab and menus!

I am really confused and in need of help. I posted on workflow's page about this too because I can't tell what module is causing what issue.

Becky

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

RdeBoer’s picture

I suggest we get our brains around #751114: I can't get revisioning uninstalled first, before returning to this issue.

There are at least a couple of ways to "unpublish", depending on permissions. What role are you in when you do the above? What link on what page do you use to unpublish? Are you using the "Published" tick-box on the Edit page (requires "administer nodes"), perhaps?

beckyjohnson’s picture

Ok. First of all, if I go to the revisioning tab when it is installed, I can click on the tab that says unpublish and it will. However, I get a white blank page after I click on the tab. It does unpublish though. But, if I go to the node and just uncheck the publish check box and save, the node remains saved. I kind of wonder what is going on. I am using this module with workflow and it was in the state it needs to be in, in order to be published.....would that effect things?

RdeBoer’s picture

Sorry Becky -- can't reproduce, especially not the white page.
So you must be logged in as admin...
What do you get when you first click the "Revisions" tab and then click the link "Unpublish current revision" (as opposed to "Unpublish this" tab on the following page)?
Have you created any Actions or Rules that are triggered upon saving?

NaX’s picture

Title: Revisioning is not letting me unpublish nodes » Revisioning is not letting me unpublish nodes
Version: 6.x-3.7 » 6.x-3.11

I have this same problem. I am only able to unpublish content by going to "Unpublish this" tab when viewing a revision, but when I un-check the publish checkbox or when I use the update options action under admin/content/node or when I use a unpublish action through views bulk operations I always get a message Auto-publishing this revision.

This means I am only able to unpublish content manually one item at a time by using the Unpublish this tab eliminating all bulk management operation.

RdeBoer’s picture

Thanks for the report.
Looks like you're experiencing two types of interference
1) when you're logged in as someone with the 'administer nodes' permission (e.g uid=1) and uncheck the 'Publish' box
2) when using VBO
I will investigate as soon as I have some time.
Note that the symptoms should go away if you're willing to sacrifice the auto-pubslish feature, i.e. untick the box Auto-publish drafts of type <type > (for moderators).

NaX’s picture

@RdeBoer
Thanks for looking into this.

I don't fully understand how Drupal's revision system works and how Revisioning interacts with Drupals' revisions.

What do you think will happen if we remove the $node->status = TRUE; from the presave auto publish code.
As far as I can tell it will still make the new revision the current item but will retain the nodes status set by the user/action/rule.

If this is the case then this would work for my needs. I need Auto-Publishing of the latest revision but I also need the node status/publish settings to be retained. I hope that makes sense. I have not tested this yet.

EG:

  if (user_access('auto publish revisions') && variable_get('revisioning_auto_publish_'. $node->type, FALSE)) {
    drupal_set_message(t('Auto-publishing this revision.'));
    // Make sure the 'update' does NOT reset vid, so that new revision becomes current
    unset($node->current_revision_id);
  }

If I am correct in my assumption, we could add a second setting to the Auto-Publish settings, something like "Force node publish status". In this way we break up the two concepts.

I hope all that makes sense.

mahesh e p’s picture

@NaX
Thanks. #6 workaround worked and best solution for me

avibrazil@gmail.com’s picture

I am having this conflict.

I would be satisfied if Revisioning module could simply make a VBO action appear on its pull down menu saying 'unpublish this revision'.

Or just paste here the PHP code that calls Revisioning API we could use in the VBO 'execute PHP code' action.

Thanks in advance

CatherineOmega’s picture

I only use Revisioning on a single site, but it seems to prohibit administrators from EVER unpublishing a published node; as long as "Auto-publish drafts of type news_post (for moderators)" is checked in a CCK type's Workflow settings, any change to the node is detected as a revision...which gets automatically published.

...which is inconvenient when you have a site that needs Revisioning and your content type is called "news_post", you know? :)

Mac Clemmens’s picture

My suggestion is to unset "revision_moderation" on node form submission when "status" = 0.

When the user does not want to publish a node, it should not create a draft to be auto-approved by an administrator.

I added this to a hook_form_alter function for any node form of the applicable content type:

  $form['#submit'][] = 'mymodule_ensure_new_drafts_arent_created_for_unpublished_node_submit';

And then,

function mymodule_ensure_new_drafts_arent_created_for_unpublished_node_submit($form, &$form_state) {
  if (!$form_state['values']['status']) {
    $form_state['values']['revision_moderation'] = FALSE;
  }
}

And it stopped trying to publish the nodes we were unchecking the "Published" checkbox on.

decafdennis’s picture

Version: 6.x-3.11 » 6.x-3.12
Component: User interface » Code
Category: support » bug

Changing this to a bug report.

Might I suggest another workaround:

/**
 * Implementation of hook_nodeapi().
 */ 
function mymodule_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  switch ($op) {
    case 'presave':
      // If, for an existing node, the status was changed from 1 to 0, disable revisioning auto publishing
      if (!empty($node->nid)) {
        $status_before = db_result(db_query("SELECT status FROM {node} WHERE nid = %d", $node->nid));
        
        if ($status_before == 1 && $node->status == 0) {
          $node->revision_moderation = FALSE;
        }
      }
      break;
  }
}

Note that this workaround only works if the module in which this is implemented has a lower weight than the revisioning module.

RdeBoer’s picture

Version: 6.x-3.12 » 6.x-3.x-dev
Assigned: Unassigned » RdeBoer
Status: Active » Fixed

Checked into Git (6.x-3.x branch) a solution based on naquah's (#11) -- with creditation, see http://drupal.org/node/407994/committers.

Status: Fixed » Closed (fixed)

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

olmyr’s picture

when you create a new node and press unpublish. However, the node is still published.
Here my simple fix:

<?php
            // Fix for #751092: Revisioning is not letting me unpublish nodes (thanks naquah)
            $was_published = db_result(db_query("SELECT status FROM {node} WHERE nid = %d", $node->nid));
            - if ($was_published && !$node->status) {
            + if (($was_published && !$node->status) || (empty($was_published))) {
              // If the Publish box has just been unticked, do not auto-publish
              break;
            }
?>
RdeBoer’s picture

@mirgorod_a, #14:
Agree with the symptoms you found. However, I don't think your solutions is quite right, as $was_published will be empty for ANY new node, regardless of the how the Publish box was ticked (this is because for a new node $node->nid is empty).
Basically, for a new node the only way to tell whether the box was ticked by default and then unticked on the edit form is by finding out what the default is for the content type. So I checked in this code:

            if (!$node->status) {
              // Fix for #751092: Revisioning is not letting me unpublish nodes (thanks naquah and mirgorod_a).
              // If the Publish box has just been unticked, do not auto-publish.
              if (isset($node->nid)) {
                 // Existing published node for which Publish box was unticked.
                if (db_result(db_query("SELECT status FROM {node} WHERE nid = %d", $node->nid))) {
                  break;
                }
              }
              else {
                $node_options = variable_get('node_options_'. $node->type, array());
                if (in_array('status', $node_options)) {
                  // New node for which Publish box is ticked by default but was
                  // unticked on the edit form.
                  break;
                }
              }
            }
RdeBoer’s picture

Status: Closed (fixed) » Fixed

Changing status to fixed (again).

Status: Fixed » Closed (fixed)

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

TechNikh’s picture

Version: 6.x-3.x-dev » 7.x-1.4
Assigned: RdeBoer » Unassigned
Status: Closed (fixed) » Active

same issue with Drupal 7.
when I unpublish, selected content in admin/content section, It says "Auto-publishing this revision."

RdeBoer’s picture

Status: Active » Closed (cannot reproduce)
HairMachine’s picture

We're also seeing this issue on a site with the 7.x-1.5 version of Revisioning - if you navigate to the admin/content page and select a few nodes to be unpublished, they are immediately re-published with the message 'Auto-publishing this revision'.

Might try adapting one of these workarounds for D7, shouldn't be too difficult... (famous last words)

TechNikh’s picture

Status: Closed (cannot reproduce) » Active

marking it active as per #20

HairMachine’s picture

Indeed it was easy! If anyone else is seeing this behaviour in Drupal 7, this adaption of #11 seemed to do the trick.

<?php
/**
 * Implements hook_node_presave
 */
function my_module_node_presave($node) {
  if (!empty($node->nid)) {
    $status_before = db_query("SELECT status FROM {node} WHERE nid = :nid", array(':nid' => $node->nid))->fetchObject();
    if ($node->status == 0 && $status_before->status == 1) {
      $node->revision_moderation = FALSE;
    }
  }
}
?>
RdeBoer’s picture

Thanks HairMachine!
Rik

jackalope’s picture

Issue summary: View changes

I can confirm that the code published in #22 does the trick for this problem in Drupal 7; that said, can this somehow be fixed within the D7 version of the Revisioning module itself?

jastraat’s picture

Since the original node is already present, you don't need to do a db_query. Suggested edit:

function MODULE_node_presave($node) {
  if (isset($node->nid) && isset($node->original)) {
    if ($node->status == 0 && $node->original->status == 1) {
      $node->revision_moderation = FALSE;
    }
  }
}
Chris Burge’s picture

Version: 7.x-1.4 » 7.x-1.x-dev
Status: Active » Needs review
FileSize
789 bytes

This is a bug in the Revisioning module and shouldn't require a custom module and hook_node_presave() to correct. Attached is patch that implements #25 in revisioning_node_presave().

filsterjisah’s picture

Status: Needs review » Reviewed & tested by the community

Tested, works great!

jannis’s picture

RTBC + 1

can we get this committed?

RdeBoer’s picture

Assigned: Unassigned » RdeBoer
Status: Reviewed & tested by the community » Fixed

Committed #26.
Thank you jastraat and Chris Burge

Status: Fixed » Closed (fixed)

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