// This can be done when we can delete cache entries via wildcard
$r = q("SELECT `group`.`id`, `group`.`name`, GROUP_CONCAT(DISTINCT `group_member`.`contact-id` SEPARATOR ',') AS uids
FROM `group`
- INNER JOIN `group_member` ON `group_member`.`gid`=`group`.`id` AND `group_member`.`uid` = `group`.`uid`
+ INNER JOIN `group_member` ON `group_member`.`gid`=`group`.`id`
WHERE NOT `group`.`deleted` AND `group`.`uid` = %d
$sql_extra
GROUP BY `group`.`name`, `group`.`id`
}
foreach ($account['group_member'] as &$group_member) {
- $group_member['uid'] = $newuid;
-
$import = 0;
foreach ($account['group'] as $group) {
if ($group['id'] == $group_member['gid'] && isset($group['newid'])) {
);
$group_member = _uexport_multirow(
- sprintf("SELECT * FROM `group_member` WHERE uid = %d", intval(local_user()))
+ sprintf("SELECT `group_member`.`gid`, `group_member`.`contact-id` FROM `group_member` INNER JOIN `group` ON `group`.`id` = `group_member`.`gid` WHERE `group`.`uid` = %d", intval(local_user()))
);
$output = array(
$database["group_member"] = array(
"fields" => array(
"id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
- "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
"gid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("group" => "id")),
"contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
),
"PRIMARY" => array("id"),
"contactid" => array("contact-id"),
"gid_contactid" => array("gid", "contact-id"),
- "uid_gid_contactid" => array("UNIQUE", "uid", "gid", "contact-id"),
)
);
$database["gserver"] = array(
INNER JOIN `group_member`
ON `contact`.`id` = `group_member`.`contact-id`
WHERE `gid` = ?
- AND `group_member`.`uid` = ?
+ AND `contact`.`uid` = ?
AND NOT `contact`.`self`
AND NOT `contact`.`blocked`
AND NOT `contact`.`pending`
INNER JOIN `group_member`
ON `contact`.`id` = `group_member`.`contact-id`
WHERE `gid` = ?
- AND `group_member`.`uid` = ?
+ AND `contact`.`uid` = ?
AND `contact`.`network` = ?
AND `contact`.`notify` != ""',
$gid,
AND NOT `pending`
AND `id` NOT IN (
SELECT DISTINCT(`contact-id`)
- FROM `group_member` WHERE `uid` = %d
+ FROM `group_member`
+ JOIN `group` ON `group`.`id` = `group_member`.`gid`
+ WHERE `group`.`uid` = %d
)
LIMIT %d, %d", intval($uid), intval($uid), intval($start), intval($count)
);
AND `contact-id` IN
(SELECT `contact-id`
FROM `group_member`
- WHERE `group_member`.`gid` = `group`.`id`
- AND `group_member`.`uid` = ?)
+ WHERE `group_member`.`gid` = `group`.`id`)
) AS `count`
FROM `group`
WHERE `group`.`uid` = ?;",