]> git.mxchange.org Git - friendica.git/commitdiff
Only show valid contacts on the group side
authorMichael Vogel <icarus@dabo.de>
Sun, 8 Nov 2015 15:41:00 +0000 (16:41 +0100)
committerMichael Vogel <icarus@dabo.de>
Sun, 8 Nov 2015 15:41:00 +0000 (16:41 +0100)
include/group.php
mod/group.php

index b7e1963bf37901cb2d6d77a3ca6d8ae224752c6b..fe29d39f1a810ae86eb6ec5ef66d630c7538831e 100644 (file)
@@ -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,7 +207,7 @@ 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;
 }
index 4a447713dc055d5c9ea5f7a0f5322cb40088159f..263586e2e903458f1cf7627a8849ffc4bdc64149 100644 (file)
@@ -62,12 +62,12 @@ function group_post(&$a) {
 
                $a->page['aside'] = group_side();
        }
-       return; 
+       return;
 }
 
 function group_content(&$a) {
        $change = false;
-       
+
        if(! local_user()) {
                notice( t('Permission denied') . EOL);
                return;
@@ -172,7 +172,7 @@ function group_content(&$a) {
                        '$form_security_token' => get_form_security_token("group_drop"),
                ));
 
-               
+
                $context = $context + array(
                        '$title' => t('Group Editor'),
                        '$gname' => array('groupname',t('Group Name: '),$group['name'], ''),
@@ -192,7 +192,7 @@ function group_content(&$a) {
                'label_contacts' => t('All Contacts'),
                'contacts' => array(),
        );
-               
+
        $sec_token = addslashes(get_form_security_token('group_member_change'));
        $textmode = (($switchtotext && (count($members) > $switchtotext)) ? true : false);
        foreach($members as $member) {
@@ -226,8 +226,7 @@ function group_content(&$a) {
                echo replace_macros($tpl, $context);
                killme();
        }
-       
+
        return replace_macros($tpl, $context);
 
 }
-