X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Fgroup.php;h=da4d41748b31c61e8061ba1188babd8380b7efbe;hb=d28d2ff440efba47ad65cf28eab4be96e0ea05b2;hp=793e854be046bc7f43db7572b249621e2dc19e8d;hpb=f0b640058427aff2d9d60899f9005980ab89c0ef;p=friendica.git diff --git a/include/group.php b/include/group.php index 793e854be0..da4d41748b 100644 --- a/include/group.php +++ b/include/group.php @@ -108,9 +108,9 @@ function group_get_members($gid) { if(intval($gid)) { $r = q("SELECT `group_member`.`contact-id`, `contact`.* FROM `group_member` LEFT JOIN `contact` ON `contact`.`id` = `group_member`.`contact-id` - WHERE `gid` = %d AND `group_member`.`uid` = %d", + WHERE `gid` = %d AND `group_member`.`uid` = %d ORDER BY `contact`.`name` ASC ", intval($gid), - intval($_SESSION['uid']) + intval(local_user()) ); if(count($r)) $ret = $r; @@ -118,9 +118,25 @@ function group_get_members($gid) { return $ret; } +function group_public_members($gid) { + $ret = 0; + if(intval($gid)) { + $r = q("SELECT `contact`.`id` AS `contact-id` FROM `group_member` + LEFT JOIN `contact` ON `contact`.`id` = `group_member`.`contact-id` + WHERE `gid` = %d AND `group_member`.`uid` = %d + AND `contact`.`network` != 'dfrn' AND `contact`.`network` != 'mail' AND `contact`.`network` != 'face' ", + intval($gid), + intval(local_user()) + ); + if(count($r)) + $ret = count($r); + } + return $ret; +} + -function group_side($every="contacts",$each="group") { +function group_side($every="contacts",$each="group",$edit = false, $group_id = 0) { $o = ''; @@ -129,7 +145,7 @@ function group_side($every="contacts",$each="group") { $createtext = t('Create a new group'); $linktext= t('Everybody'); - + $selected = (($group_id == 0) ? ' class="group-selected" ' : ''); $o .= <<< EOT
"; @@ -169,3 +187,15 @@ function expand_groups($a) { $ret[] = $rr['contact-id']; return $ret; } + + +function member_of($c) { + + $r = q("SELECT `group`.`name`, `group`.`id` FROM `group` LEFT JOIN `group_member` ON `group_member`.`gid` = `group`.`id` WHERE `group_member`.`contact-id` = %d AND `group`.`deleted` = 0 ORDER BY `group`.`name` ASC ", + intval($c) + ); + + return $r; + +} +