From d5cdbcd6444e9d36db64c1f80a70611f779ede94 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sat, 12 Jul 2003 10:36:56 +0000 Subject: - Bugfix: fixed username not being fetched with the title module. Fixes bug #1852. (Going to backport this to the DRUPAL-4-2-0 branch.) --- modules/title.module | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'modules/title.module') diff --git a/modules/title.module b/modules/title.module index e846f9750..2126ca83d 100644 --- a/modules/title.module +++ b/modules/title.module @@ -11,10 +11,12 @@ function title_page() { $title = urldecode(arg(1)); $result = db_query("SELECT n.*, u.name, u.uid FROM {node} n LEFT JOIN {users} u ON n.uid = u.uid WHERE n.title = '%s' AND n.status = 1 ORDER BY created DESC", $title); + if (db_num_rows($result) == 0) { // No node with exact title found, try substring. - $result = db_query("SELECT n.* FROM {node} n WHERE n.title LIKE '%". check_query($title). "%' AND n.status = 1 ORDER BY created DESC"); + $result = db_query("SELECT n.*, u.name, u.uid FROM {node} n LEFT JOIN {users} u ON n.uid = u.uid WHERE n.title LIKE '%". check_query($title). "%' AND n.status = 1 ORDER BY created DESC"); } + if (db_num_rows($result) == 0 && module_exist("search")) { // still no matches ... return a full text search search_view($title); -- cgit v1.2.3