From f09249a9795a154c74e7a4368970991d0b64e1b8 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Mon, 15 Mar 2010 16:25:44 -0500 Subject: [PATCH] Fixing sql query to work with the multiple url feature --- main/user/subscribe_user.php | 79 +++++++++++++++--------------------- 1 file changed, 33 insertions(+), 46 deletions(-) diff --git a/main/user/subscribe_user.php b/main/user/subscribe_user.php index 5c407a9bff..c3167b9afd 100755 --- a/main/user/subscribe_user.php +++ b/main/user/subscribe_user.php @@ -1,24 +1,18 @@ ".DRH." AND access_url_id= $url_access_id "; + u.user_id AS col0, + u.official_code AS col1, + ".($is_western_name_order + ? "u.firstname AS col2, + u.lastname AS col3," + : "u.lastname AS col2, + u.firstname AS col3,")." + u.email AS col4, + u.active AS col5, + u.user_id AS col6 + FROM $user_table u + LEFT JOIN $course_user_table cu on u.user_id = cu.user_id and course_code='".$_SESSION['_course']['id']."' + INNER JOIN $tbl_url_rel_user as url_rel_user + ON (url_rel_user.user_id = u.user_id) "; // applying the filter of the additional user profile fields @@ -539,11 +526,11 @@ function get_user_data($from, $number_of_items, $column, $direction) { ON field_values.user_id = u.user_id WHERE cu.user_id IS NULL AND u.status<>".DRH." AND field_values.field_id = '".Database::escape_string($field_identification[0])."' - AND field_values.field_value = '".Database::escape_string($field_identification[1])."'"; + AND field_values.field_value = '".Database::escape_string($field_identification[1])."' AND access_url_id= $url_access_id "; } else { - $sql .= "WHERE cu.user_id IS NULL AND u.status<>".DRH." AND access_url_id= $url_access_id "; - } - + $sql .= "WHERE cu.user_id IS NULL AND u.status<>".DRH." AND access_url_id= $url_access_id "; + } + } } } @@ -573,6 +560,7 @@ function get_user_data($from, $number_of_items, $column, $direction) { // Sorting and pagination (used by the sortable table) $sql .= " ORDER BY col$column $direction "; $sql .= " LIMIT $from,$number_of_items"; + $res = Database::query($sql); $users = array (); while ($user = Database::fetch_row($res)) { @@ -593,7 +581,6 @@ function get_user_data($from, $number_of_items, $column, $direction) { } } } - } return $users; }