<?php
/**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
$group = DBA::selectFirst('group', ['deleted'], ['id' => $gid]);
if (DBA::isResult($group) && $group['deleted']) {
DBA::update('group', ['deleted' => 0], ['id' => $gid]);
- notice(DI::l10n()->t('A deleted group with this name was revived. Existing item permissions <strong>may</strong> apply to this group and any future members. If this is not what you intended, please create another group with a different name.') . EOL);
+ notice(DI::l10n()->t('A deleted group with this name was revived. Existing item permissions <strong>may</strong> apply to this group and any future members. If this is not what you intended, please create another group with a different name.'));
}
return true;
}
public static function countUnseen()
{
$stmt = DBA::p("SELECT `group`.`id`, `group`.`name`,
- (SELECT COUNT(*) FROM `item` FORCE INDEX (`uid_unseen_contactid`)
+ (SELECT COUNT(*) FROM `post-user`
WHERE `uid` = ?
AND `unseen`
AND `contact-id` IN
return $return;
}
- /**
- * Mark a group as deleted based on its name
- *
- * @param int $uid
- * @param string $name
- * @return bool
- * @throws \Exception
- * @deprecated Use Group::remove instead
- *
- */
- public static function removeByName($uid, $name)
- {
- $return = false;
- if (!empty($uid) && !empty($name)) {
- $gid = self::getIdByName($uid, $name);
-
- $return = self::remove($gid);
- }
-
- return $return;
- }
-
/**
* Adds a contact to a group
*
return $return;
}
- /**
- * Removes a contact from a group based on its name
- *
- * @param int $uid
- * @param string $name
- * @param int $cid
- * @return boolean
- * @throws \Exception
- * @deprecated Use Group::removeMember instead
- *
- */
- public static function removeMemberByName($uid, $name, $cid)
- {
- $gid = self::getIdByName($uid, $name);
-
- $return = self::removeMember($gid, $cid);
-
- return $return;
- }
-
/**
* Returns the combined list of contact ids from a group id list
*
$groupedit = null;
}
+ if ($each == 'group') {
+ $count = DBA::count('group_member', ['gid' => $group['id']]);
+ $group_name = sprintf('%s (%d)', $group['name'], $count);
+ } else {
+ $group_name = $group['name'];
+ }
+
$display_groups[] = [
'id' => $group['id'],
'cid' => $cid,
- 'text' => $group['name'],
+ 'text' => $group_name,
'href' => $each . '/' . $group['id'],
'edit' => $groupedit,
'selected' => $selected,