mirror of
https://github.com/friendica/friendica
synced 2025-04-25 16:30:10 +00:00
turn groups back into numbers
This commit is contained in:
parent
7e16f8cdae
commit
c6267a2cd2
4 changed files with 13 additions and 20 deletions
|
@ -71,23 +71,21 @@ else {
|
|||
}
|
||||
}
|
||||
|
||||
// Returns an array of group names this contact is a member of.
|
||||
// Since contact-id's are unique and each "belongs" to a given user uid,
|
||||
// this array will only contain group names related to the uid of this
|
||||
// Returns an array of group id's this contact is a member of.
|
||||
// This array will only contain group id's related to the uid of this
|
||||
// DFRN contact. They are *not* neccessarily unique across the entire site.
|
||||
|
||||
|
||||
if(! function_exists('init_groups_visitor')) {
|
||||
function init_groups_visitor($contact_id) {
|
||||
$groups = array();
|
||||
$r = q("SELECT `group_member`.`gid`, `group`.`name`
|
||||
FROM `group_member` LEFT JOIN `group` ON `group_member`.`gid` = `group`.`id`
|
||||
WHERE `group_member`.`contact-id` = %d ",
|
||||
$r = q("SELECT `gid` FROM `group_member`
|
||||
WHERE `contact-id` = %d ",
|
||||
intval($contact_id)
|
||||
);
|
||||
if(count($r)) {
|
||||
foreach($r as $rr)
|
||||
$groups[] = $rr['name'];
|
||||
$groups[] = $rr['gid'];
|
||||
}
|
||||
return $groups;
|
||||
}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue