Download & Extend

Duplicate entries in in forum_index table

Project:File (Field) Paths
Version:7.x-1.x-dev
Component:Code
Category:bug report
Priority:major
Assigned:Unassigned
Status:closed (duplicate)

Issue Summary

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

#1

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

#2

Not a fix, but a quick workaround.

<?php
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);
      }
    }
  }
}
?>

#3

Status:active» closed (duplicate)

This is a duplicate of #1464404: field_attach_update() causes issues.

nobody click here