// count friends
$r = q("SELECT count(*) as `count` FROM `contact`
WHERE `uid` = %d AND `rel` IN ( %d, %d )
- AND `self`=0 AND NOT `blocked` AND `hidden`=0",
+ AND `self`=0 AND NOT `blocked` AND NOT `pending` AND `hidden`=0",
intval($uinfo[0]['uid']),
intval(CONTACT_IS_SHARING),
intval(CONTACT_IS_FRIEND)
$r = q("SELECT count(*) as `count` FROM `contact`
WHERE `uid` = %d AND `rel` IN ( %d, %d )
- AND `self`=0 AND NOT `blocked` AND `hidden`=0",
+ AND `self`=0 AND NOT `blocked` AND NOT `pending` AND `hidden`=0",
intval($uinfo[0]['uid']),
intval(CONTACT_IS_FOLLOWER),
intval(CONTACT_IS_FRIEND)
if (dbm::is_result($r))
$updated = date("c", strtotime($r[0]['updated']));
- $r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `hidden` AND NOT `archive`
+ $r = q("SELECT COUNT(*) AS `total` FROM `contact`
+ WHERE `uid` = %d
+ AND NOT `self` AND NOT `blocked` AND NOT `pending`
+ AND NOT `hidden` AND NOT `archive`
AND `network` IN ('%s', '%s', '%s', '')",
intval($profile['uid']),
dbesc(NETWORK_DFRN),
return $o;
$r = q("SELECT COUNT(*) AS `total` FROM `contact`
WHERE `uid` = %d AND NOT `self` AND NOT `blocked`
- AND NOT `hidden` AND NOT `archive`
+ AND NOT `pending` AND NOT `hidden` AND NOT `archive`
AND `network` IN ('%s', '%s', '%s')",
intval($a->profile['uid']),
dbesc(NETWORK_DFRN),
// Splitting the query in two parts makes it much faster
$r = q("SELECT `id` FROM `contact`
WHERE `uid` = %d AND NOT `self` AND NOT `blocked`
- AND NOT `hidden` AND NOT `archive`
- AND `network` IN ('%s', '%s', '%s') ORDER BY RAND() LIMIT %d",
+ AND NOT `pending` AND NOT `hidden` AND NOT `archive`
+ AND `network` IN ('%s', '%s', '%s')
+ ORDER BY RAND() LIMIT %d",
intval($a->profile['uid']),
dbesc(NETWORK_DFRN),
dbesc(NETWORK_OSTATUS),
}
$r = q("SELECT COUNT(*) AS `total` FROM `contact`
- WHERE `uid` = %d AND (NOT `blocked` OR `pending`) AND NOT `hidden` AND NOT `archive`
+ WHERE `uid` = %d AND NOT `blocked` AND NOT `pending`
+ AND NOT `hidden` AND NOT `archive`
AND `network` IN ('%s', '%s', '%s')",
intval($a->profile['uid']),
dbesc(NETWORK_DFRN),
$a->set_pager_total($r[0]['total']);
$r = q("SELECT * FROM `contact`
- WHERE `uid` = %d AND (NOT `blocked` OR `pending`) AND NOT `hidden` AND NOT `archive`
+ WHERE `uid` = %d AND NOT `blocked` AND NOT `pending`
+ AND NOT `hidden` AND NOT `archive`
AND `network` IN ('%s', '%s', '%s')
ORDER BY `name` ASC LIMIT %d, %d",
intval($a->profile['uid']),