I have a site using te forum module (7.12) and the file field path module. When I edit an existing forum topic (the starting node of a discussion), I end up with a duplicate entry in the forum_index table and when I display the list of forum topics, the edited topic appears twice.

Disabling the file field path module brings everything back to normal.

There's no file field in my forum data type.

Comments

ressa’s picture

Priority: Normal » Major

Edited forum posts showing up twice in forum list is still an issue in 7.x-1.x-dev release from 2012-Aug-10.

Forum posts are displayed twice in the list of forum posts, after they are edited. In the forum_index table the post appears twice, with identical content, which is why it is shown twice.

To reproduce:

  1. Install Drupal Core forum and File (Field) Paths
  2. Create a forum post
  3. Edit it
  4. View the forum, the edited post is displayed twice
Alan D.’s picture

Not a fix, but a quick workaround.

function HOOK_entity_update($entity, $type) {
  if ($type == 'node' && function_exists('_forum_node_check_node_type')) {
    if (_forum_node_check_node_type($entity)) {
      $query = db_select('forum_index', 'f')
        ->condition('nid', $entity->nid)
        ->fields('f');
      $query->addExpression('count(*)', 'count');
      $query->addExpression("concat( nid, '_', tid)", 'concat_id');
      $query->groupBy('concat_id');
      $query->havingCondition('count', 1, '>');
      $result = $query->execute();
      foreach ($result as $row) {
        db_delete('forum_index')->condition('nid', $row->nid)->condition('tid', $row->tid)->execute();
        drupal_write_record('forum_index', $row);
      }
    }
  }
}
Deciphered’s picture

Status: Active » Closed (duplicate)
Deciphered’s picture

Issue summary: View changes
Status: Closed (duplicate) » Active

Confirmed as still an active issue.

  • Deciphered committed c4d223c on 7.x-1.x
    #1481260: Changed hook_entity_update() to hook_field_storage_pre_update...
Deciphered’s picture

Status: Active » Fixed

Fix committed.

Status: Fixed » Closed (fixed)

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