]> git.mxchange.org Git - friendica.git/blobdiff - include/contact_widgets.php
Merge pull request #514 from hmeine/master
[friendica.git] / include / contact_widgets.php
index 42d3afdee7cd375e6f9e546a0349595d9533dd13..ea71b3b707b35b5a2fe3c3d5c976eb6be15ace63 100644 (file)
@@ -142,9 +142,16 @@ function common_friends_visitor_widget($profile_uid) {
 
        $cid = $zcid = 0;
 
-       if(can_write_wall($a,$profile_uid))
-               $cid = remote_user();
-       else {
+       if(is_array($_SESSION['remote'])) {
+               foreach($_SESSION['remote'] as $visitor) {
+                       if($visitor['uid'] == $profile_uid) {
+                               $cid = $visitor['cid'];
+                               break;
+                       }
+               }
+       }
+
+       if(! $cid) {
                if(get_my_url()) {
                        $r = q("select id from contact where nurl = '%s' and uid = %d limit 1",
                                dbesc(normalise_link(get_my_url())),
@@ -183,7 +190,8 @@ function common_friends_visitor_widget($profile_uid) {
                '$desc' =>  sprintf( tt("%d contact in common", "%d contacts in common", $t), $t),
                '$base' => $a->get_baseurl(),
                '$uid' => $profile_uid,
-               '$cid' => $cid,
+               '$cid' => (($cid) ? $cid : '0'),
+               '$linkmore' => (($t > 5) ? 'true' : ''),
                '$more' => t('show more'),
                '$items' => $r
        ));