summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.txt1
-rw-r--r--modules/userreference/userreference.module12
2 files changed, 8 insertions, 5 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 2830b29..640c53f 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -24,6 +24,7 @@ Bugfixes:
- #369364 Views integration: fix non-XHTML markup when displaying fields with the 'group multiple values' option.
- #441412 by jcnventura - Add 'Print' display context on 'Display fields' pages when book.module is enabled.
- #458952 Let different modules defined the same build_mode information.
+- #383038 by markDrupal - Userreference: fix broken 'reverse links' with fields in per-type table.
CCK 6.x-2.2
===========
diff --git a/modules/userreference/userreference.module b/modules/userreference/userreference.module
index ec16329..0936ab5 100644
--- a/modules/userreference/userreference.module
+++ b/modules/userreference/userreference.module
@@ -860,14 +860,16 @@ function userreference_user($type, &$edit, &$account) {
// Only add tables when reverse link has been selected.
if ($field['type'] == 'userreference' && !empty($field['widget']['reverse_link'])) {
$db_info = content_database_info($field);
- $search_tables[$db_info['table']] = $db_info['columns']['uid']['column'];
+ $search_tables[$db_info['table']][] = $db_info['columns']['uid']['column'];
}
}
}
- foreach ($search_tables as $table => $column) {
- $ids = db_query(db_rewrite_sql("SELECT DISTINCT(n.nid), n.title, n.type FROM {node} n LEFT JOIN {". $table ."} f ON n.vid = f.vid WHERE f.". $column ."=". $account->uid. " AND n.status = 1"));
- while ($data = db_fetch_object($ids)) {
- $additions[$data->type][$data->nid] = $data->title;
+ foreach ($search_tables as $table => $columns) {
+ foreach ($columns as $column) {
+ $ids = db_query(db_rewrite_sql("SELECT DISTINCT(n.nid), n.title, n.type FROM {node} n LEFT JOIN {". $table ."} f ON n.vid = f.vid WHERE f.". $column ."=". $account->uid. " AND n.status = 1"));
+ while ($data = db_fetch_object($ids)) {
+ $additions[$data->type][$data->nid] = $data->title;
+ }
}
}
$account->userreference = $additions;