Commit 52204947 authored by Martyn Smith's avatar Martyn Smith Committed by Martyn Smith
Browse files

Fix adding users to controlled communities

parent 1cca3989
......@@ -173,7 +173,7 @@ function get_associated_communities($userid=0) {
/**
* gets communities the user is a tutor in
* gets communities the user is a tutor in, or the user owns
*
* @param int $userid (optional, defaults to $USER id)
* @param string $jointype (optional, will filter by jointype
......@@ -186,7 +186,7 @@ function get_tutor_communities($userid=0, $jointype=null) {
$sql = 'SELECT DISTINCT c.*, cm.ctime
FROM ' . $prefix . 'community c
LEFT JOIN ' . $prefix . 'community_member cm ON cm.community = c.id
WHERE (cm.member IS NULL AND c.owner = ?) OR (cm.member = ? AND cm.tutor = ?)';
WHERE (c.owner = ? OR (cm.member = ? AND cm.tutor = ?))';
$values = array($userid, $userid, 1);
if (!empty($jointype)) {
......
......@@ -162,8 +162,8 @@ if ($communities = get_tutor_communities($loggedinid, 'controlled')) {
$default = $default[0];
$addform = pieform(array(
'name' => 'addmember',
'ajaxform' => true,
'ajaxsuccesscallback' => 'add_success',
'jsform' => true,
'jssuccesscallback' => 'add_success',
'elements' => array(
'community' => array(
'type' => 'select',
......
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