Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
There's a problem with the way the unpublishing of nodes is done that leads to an unpublished node being shown as "Published" in the admin/content view when using revisions.
The problem is located line 1976 of antispam.module:
if ($content_type == 'node') {
// This code snippet is based on node.module::node_admin_nodes_submit()
// Only the node record is updated, no other hooks are invoked.
// perform the update action.
db_update('node')
->fields(array(
'status' => ($op == 'publish'? 1:0)
))
->condition('nid', $content->nid)
->execute();
[...]
}
Only the node is updated, not the revisions. We need to also update the current revision like so:
// perform the update action.
db_update('node')
->fields(array(
'status' => ($op == 'publish'? 1:0)
))
->condition('nid', $content->nid)
->execute();
// perform the update action of the revision.
db_update('node_revision')
->fields(array(
'status' => ($op == 'publish'? 1:0)
))
->condition('nid', $content->nid)
->condition('vid', $content->vid)
->execute();
I'm attaching the patch file for those who want it.
Comment | File | Size | Author |
---|---|---|---|
#5 | antispam-n2194633-5.patch | 1.14 KB | DamienMcKenna |
Comments
Comment #1
Growiel CreditAttribution: Growiel commentedComment #3
Growiel CreditAttribution: Growiel commentedNew patch... (I patched from environement, not from a git clone of antispam so it failed)
Comment #4
Growiel CreditAttribution: Growiel commentedComment #5
DamienMcKennaRerolled, and fixed some small formatting mistakes.
Comment #6
DamienMcKennaCommitted.
Comment #7
DamienMcKennaNeeds to be backportted to D6.
Comment #8
Growiel CreditAttribution: Growiel commentedI don't have or know D6, I unassigned from myself as I can't do the backport.
Comment #9
apadernoI am closing this issue, since Drupal 4.x, 5.x, and 6.x are now not supported.