X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fgroup.php;h=862d06818dd0957bb8a7428f3a7c7b996b953e89;hb=be40fb8186bc18e3562d780a7153f76ee7d5e90f;hp=bbfac7ac1d6819e77d2b592e4b96102e673a2fbd;hpb=5a1bb9866dbb09b00861688f4a78baf0391ea58f;p=friendica.git diff --git a/include/group.php b/include/group.php index bbfac7ac1d..862d06818d 100644 --- a/include/group.php +++ b/include/group.php @@ -156,9 +156,11 @@ function group_add_member($uid,$name,$member,$gid = 0) { function group_get_members($gid) { $ret = array(); if(intval($gid)) { - $r = q("SELECT `group_member`.`contact-id`, `contact`.* FROM `group_member` - INNER JOIN `contact` ON `contact`.`id` = `group_member`.`contact-id` - WHERE `gid` = %d AND `group_member`.`uid` = %d ORDER BY `contact`.`name` ASC ", + $r = q("SELECT `group_member`.`contact-id`, `contact`.* FROM `group_member` + INNER JOIN `contact` ON `contact`.`id` = `group_member`.`contact-id` + WHERE `gid` = %d AND `group_member`.`uid` = %d AND + NOT `contact`.`self` AND NOT `contact`.`blocked` AND NOT `contact`.`pending` + ORDER BY `contact`.`name` ASC ", intval($gid), intval(local_user()) ); @@ -171,14 +173,14 @@ function group_get_members($gid) { function group_public_members($gid) { $ret = 0; if(intval($gid)) { - $r = q("SELECT `contact`.`id` AS `contact-id` FROM `group_member` - INNER JOIN `contact` ON `contact`.`id` = `group_member`.`contact-id` - WHERE `gid` = %d AND `group_member`.`uid` = %d + $r = q("SELECT `contact`.`id` AS `contact-id` FROM `group_member` + INNER JOIN `contact` ON `contact`.`id` = `group_member`.`contact-id` + WHERE `gid` = %d AND `group_member`.`uid` = %d AND `contact`.`network` = '%s' AND `contact`.`notify` != '' ", intval($gid), intval(local_user()), dbesc(NETWORK_OSTATUS) - ); + ); if(count($r)) $ret = count($r); } @@ -187,7 +189,7 @@ function group_public_members($gid) { function mini_group_select($uid,$gid = 0) { - + $grps = array(); $o = ''; @@ -205,15 +207,26 @@ function mini_group_select($uid,$gid = 0) { $o = replace_macros(get_markup_template('group_selection.tpl'), array( '$label' => t('Default privacy group for new contacts'), - '$groups' => $grps + '$groups' => $grps )); return $o; } - - -function group_side($every="contacts",$each="group",$edit = false, $group_id = 0, $cid = 0) { +/** + * @brief Create group sidebar widget + * + * @param string $every + * @param string $each + * @param string $editmode + * 'standard' => include link 'Edit groups' + * 'extended' => include link 'Create new group' + * 'full' => include link 'Create new group' and provide for each group a link to edit this group + * @param int $group_id + * @param int $cid + * @return string + */ +function group_side($every="contacts",$each="group",$editmode = "standard", $group_id = 0, $cid = 0) { $o = ''; @@ -237,13 +250,13 @@ function group_side($every="contacts",$each="group",$edit = false, $group_id = 0 $member_of = array(); if($cid) { $member_of = groups_containing(local_user(),$cid); - } + } if(count($r)) { foreach($r as $rr) { $selected = (($group_id == $rr['id']) ? ' group-selected' : ''); - if ($edit) { + if ($editmode == "full") { $groupedit = array( 'href' => "group/".$rr['id'], 'title' => t('edit'), @@ -263,21 +276,24 @@ function group_side($every="contacts",$each="group",$edit = false, $group_id = 0 ); } } - - + + $tpl = get_markup_template("group_side.tpl"); $o = replace_macros($tpl, array( - '$title' => t('Groups'), + '$title' => t('Groups'), + 'newgroup' => (($editmode == "extended") || ($editmode == "full") ? 1 : ''), + '$editgroupstext' => t('Edit groups'), + 'grouppage' => "group/", '$edittext' => t('Edit group'), '$createtext' => t('Create a new group'), - '$creategroup' => t('Group Name: '), - '$form_security_token' => get_form_security_token("group_edit"), + '$creategroup' => t('Group Name: '), + '$form_security_token' => get_form_security_token("group_edit"), '$ungrouped' => (($every === 'contacts') ? t('Contacts not in any group') : ''), - '$groups' => $groups, - '$add' => t('add'), + '$groups' => $groups, + '$add' => t('add'), )); - - + + return $o; }