Browse Source

Merge pull request #2049 from annando/1511-only-valid-contacts

Only show valid contacts on the group page
tags/3.4.3
Tobias Diekershoff 5 years ago
parent
commit
e6202defd1
2 changed files with 16 additions and 15 deletions
  1. +11
    -9
      include/group.php
  2. +5
    -6
      mod/group.php

+ 11
- 9
include/group.php View 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;
}


+ 5
- 6
mod/group.php View 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);

}


Loading…
Cancel
Save