diff --git a/boot.php b/boot.php index 0ab171d5f3..7ca4865d14 100644 --- a/boot.php +++ b/boot.php @@ -1678,8 +1678,19 @@ if(! function_exists('profile_sidebar')) { if (!$block){ $contact_block = contact_block(); - } + if(is_array($a->profile) AND !$a->profile['hide-friends']) { + $r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 and `pending` = 0 AND `hidden` = 0 AND `archive` = 0 + AND `network` IN ('%s', '%s', '%s', '')", + intval($profile['uid']), + dbesc(NETWORK_DFRN), + dbesc(NETWORK_DIASPORA), + dbesc(NETWORK_OSTATUS) + ); + if(count($r)) + $contacts = intval($r[0]['total']); + } + } $p = array(); foreach($profile as $k => $v) { @@ -1704,6 +1715,7 @@ if(! function_exists('profile_sidebar')) { '$homepage' => $homepage, '$about' => $about, '$network' => t('Network:'), + '$contacts' => $contacts, '$diaspora' => $diaspora, '$contact_block' => $contact_block, )); diff --git a/mod/noscrape.php b/mod/noscrape.php index 10df72eeb8..170c737767 100644 --- a/mod/noscrape.php +++ b/mod/noscrape.php @@ -31,6 +31,18 @@ function noscrape_init(&$a) { 'tags' => $keywords ); + if(is_array($a->profile) AND !$a->profile['hide-friends']) { + $r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 and `pending` = 0 AND `hidden` = 0 AND `archive` = 0 + AND `network` IN ('%s', '%s', '%s', '')", + intval($a->profile['uid']), + dbesc(NETWORK_DFRN), + dbesc(NETWORK_DIASPORA), + dbesc(NETWORK_OSTATUS) + ); + if(count($r)) + $json_info["contacts"] = intval($r[0]['total']); + } + //These are optional fields. $profile_fields = array('pdesc', 'locality', 'region', 'postal-code', 'country-name', 'gender', 'marital', 'about'); foreach($profile_fields as $field) diff --git a/view/templates/profile_vcard.tpl b/view/templates/profile_vcard.tpl index d5628115bf..08c7a77fb4 100644 --- a/view/templates/profile_vcard.tpl +++ b/view/templates/profile_vcard.tpl @@ -31,6 +31,8 @@ {{if $profile.pubkey}}{{/if}} + {{if $contacts}}{{/if}} + {{if $marital}}
{{$marital}}
{{$profile.marital}}
{{/if}} {{if $homepage}}
{{$homepage}}
{{$profile.homepage}}
{{/if}} diff --git a/view/theme/vier/templates/profile_vcard.tpl b/view/theme/vier/templates/profile_vcard.tpl index 03d4fb3a6f..e00e68644e 100644 --- a/view/theme/vier/templates/profile_vcard.tpl +++ b/view/theme/vier/templates/profile_vcard.tpl @@ -40,6 +40,8 @@ {{if $profile.pubkey}}{{/if}} + {{if $contacts}}{{/if}} + {{if $marital}}
{{$marital}}
{{$profile.marital}}
{{/if}} {{if $homepage}}
{{$homepage}}
{{$profile.homepage}}
{{/if}}