From 72a19a14aff7a13a8c1fb10e773784643f68d234 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 19 Sep 2017 17:35:57 -0700 Subject: turn common friends into a widget --- include/contact_widgets.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'include/contact_widgets.php') diff --git a/include/contact_widgets.php b/include/contact_widgets.php index aac756a46..e5bb696f8 100644 --- a/include/contact_widgets.php +++ b/include/contact_widgets.php @@ -143,7 +143,7 @@ function cardcategories_widget($baseurl,$selected = '') { -function common_friends_visitor_widget($profile_uid) { +function common_friends_visitor_widget($profile_uid,$cnt = 10) { if(local_channel() == $profile_uid) return; @@ -156,19 +156,20 @@ function common_friends_visitor_widget($profile_uid) { require_once('include/socgraph.php'); $t = count_common_friends($profile_uid,$observer_hash); + if(! $t) return; - $r = common_friends($profile_uid,$observer_hash,0,5,true); + $r = common_friends($profile_uid,$observer_hash,0,$cnt,true); return replace_macros(get_markup_template('remote_friends_common.tpl'), array( - '$desc' => sprintf( tt("%d connection in common", "%d connections in common", $t), $t), - '$base' => z_root(), - '$uid' => $profile_uid, - '$cid' => $observer, - '$linkmore' => (($t > 5) ? 'true' : ''), - '$more' => t('show more'), - '$items' => $r + '$desc' => sprintf( t('Common connections: %d'), $t), + '$base' => z_root(), + '$uid' => $profile_uid, + '$cid' => $observer, + '$linkmore' => (($t > $cnt) ? 'true' : ''), + '$more' => t('show more'), + '$items' => $r )); }; -- cgit v1.2.3