summaryrefslogtreecommitdiff
path: root/modules/forum
diff options
context:
space:
mode:
authorDries <dries@buytaert.net>2011-11-22 20:07:49 -0500
committerDries <dries@buytaert.net>2011-11-22 20:07:49 -0500
commit55eebca91306ab0e1885a9f9c2487a6e6c1ef7f2 (patch)
tree740402b08bdeb0fde706f44ecc535078c1c4b851 /modules/forum
parent8c8e291d4200fa6172d9a3a5981628d0fbbbcbe3 (diff)
downloadbrdo-55eebca91306ab0e1885a9f9c2487a6e6c1ef7f2.tar.gz
brdo-55eebca91306ab0e1885a9f9c2487a6e6c1ef7f2.tar.bz2
- Patch #1302364 by Chi, realityloop: duplicate status check in forum_field_storage_pre_update().
Diffstat (limited to 'modules/forum')
-rw-r--r--modules/forum/forum.module35
1 files changed, 16 insertions, 19 deletions
diff --git a/modules/forum/forum.module b/modules/forum/forum.module
index 65c548941..f5382163a 100644
--- a/modules/forum/forum.module
+++ b/modules/forum/forum.module
@@ -553,27 +553,24 @@ function forum_field_storage_pre_update($entity_type, $entity, &$skip_fields) {
$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) {
- $query = db_insert('forum_index')->fields(array('nid', 'title', 'tid', 'sticky', 'created', 'comment_count', 'last_comment_timestamp'));
- foreach ($entity->taxonomy_forums as $language) {
- foreach ($language as $item) {
- $query->values(array(
- 'nid' => $entity->nid,
- 'title' => $entity->title,
- 'tid' => $item['tid'],
- 'sticky' => $entity->sticky,
- 'created' => $entity->created,
- 'comment_count' => 0,
- 'last_comment_timestamp' => $entity->created,
- ));
- }
+ $query = db_insert('forum_index')->fields(array('nid', 'title', 'tid', 'sticky', 'created', 'comment_count', 'last_comment_timestamp'));
+ foreach ($entity->taxonomy_forums as $language) {
+ foreach ($language as $item) {
+ $query->values(array(
+ 'nid' => $entity->nid,
+ 'title' => $entity->title,
+ 'tid' => $item['tid'],
+ 'sticky' => $entity->sticky,
+ 'created' => $entity->created,
+ 'comment_count' => 0,
+ 'last_comment_timestamp' => $entity->created,
+ ));
}
- $query->execute();
- // The logic for determining last_comment_count is fairly complex, so
- // call _forum_update_forum_index() too.
- _forum_update_forum_index($entity->nid);
}
+ $query->execute();
+ // The logic for determining last_comment_count is fairly complex, so
+ // call _forum_update_forum_index() too.
+ _forum_update_forum_index($entity->nid);
}
}