<?php 
 if ($entity_type == 'node' && $entity->status && _forum_node_check_node_type($entity)) {
    // We don't maintain data for old revisions, so clear all previous values
    // from the table. Since this hook runs once per field, per object, make
    // sure we only wipe values once.
    if (!isset($first_call[$entity->nid])) {
      $first_call[$entity->nid] = FALSE;
      db_delete('forum_index')->condition('nid', $entity->nid)->execute();
    }
    // Only save data to the table if the node is published.
    if ($entity->status) {
       ...
    }
  }
?>

It looks as second if ($entity->status) always evaluates as TRUE;

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Chi’s picture

larowlan’s picture

Status: Needs review » Needs work
Issue tags: +Novice

Needs reroll for /core changes.

realityloop’s picture

Status: Needs work » Needs review
FileSize
2.02 KB

rerolled for /core

larowlan’s picture

Status: Needs review » Reviewed & tested by the community

Simple patch to reduce duplicate logic.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 7.x and 8.x. Thanks!

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