Commit 5de7b75f authored by Penny Leach's avatar Penny Leach
Browse files

fixed view membership requests in view community bug, made the query a

little less arcane
parent 012caf86
...@@ -97,22 +97,22 @@ switch ($type) { ...@@ -97,22 +97,22 @@ switch ($type) {
} }
break; break;
case 'members': case 'members':
$sql = 'SELECT u.*, c.tutor $select = 'SELECT u.*,c.tutor ';
FROM ' . $prefix . 'usr u JOIN ' . $prefix . 'community_member c $sql = ' FROM ' . $prefix . 'usr u JOIN ' . $prefix . 'community_member c
ON c.member = u.id ON c.member = u.id
WHERE c.community = ?'; WHERE c.community = ?';
if (empty($pending)) { // default behaviour - actual members if (empty($pending)) { // default behaviour - actual members
$count = count_records('community_member', 'community', $id); $count = count_records('community_member', 'community', $id);
$data = get_records_sql_array($sql, array($id), $offset, $limit); $data = get_records_sql_array($select . $sql, array($id), $offset, $limit);
} }
else { else {
if ($membership == COMMUNITY_MEMBERSHIP_MEMBER) { if ($membership == COMMUNITY_MEMBERSHIP_MEMBER) {
community_json_empty(); community_json_empty();
} }
$sql = str_replace('community_member', 'community_member_request', $sql); $sql = str_replace('community_member', 'community_member_request', $sql);
$sql = str_replace(',c.tutor', ',1 AS request, c.reason', $sql); $select = 'SELECT u.*, 1 AS request, c.reason';
$count = count_records('community_member_request', 'community', $id); $count = count_records('community_member_request', 'community', $id);
$data = get_records_sql_array($sql, array($id), $offset, $limit); $data = get_records_sql_array($select . $sql, array($id), $offset, $limit);
} }
if (empty($data)) { if (empty($data)) {
$data = array(); $data = array();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment