Commit db6adf1c authored by Penny Leach's avatar Penny Leach
Browse files

get_tutored_communities returns communities with owner match too

parent 6540f1be
...@@ -183,10 +183,10 @@ function get_tutor_communities($userid=0, $jointype=null) { ...@@ -183,10 +183,10 @@ function get_tutor_communities($userid=0, $jointype=null) {
$userid = optional_userid($userid); $userid = optional_userid($userid);
$prefix = get_config('dbprefix'); $prefix = get_config('dbprefix');
$sql = 'SELECT c.*, cm.ctime $sql = 'SELECT DISTINCT c.*, cm.ctime
FROM ' . $prefix . 'community c FROM ' . $prefix . 'community c
JOIN ' . $prefix . 'community_member cm ON cm.community = c.id LEFT JOIN ' . $prefix . 'community_member cm ON cm.community = c.id
WHERE c.owner != ? AND cm.member = ? AND cm.tutor = ? '; WHERE (cm.member IS NULL AND c.owner = ?) OR (cm.member = ? AND cm.tutor = ?)';
$values = array($userid, $userid, 1); $values = array($userid, $userid, 1);
if (!empty($jointype)) { if (!empty($jointype)) {
......
Markdown is supported
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