]> git.mxchange.org Git - friendica.git/commitdiff
Bugfix: The display hadn't fetched the correct contact for the uid.
authorMichael Vogel <icarus@dabo.de>
Sun, 10 Jan 2016 14:44:23 +0000 (15:44 +0100)
committerMichael Vogel <icarus@dabo.de>
Sun, 10 Jan 2016 14:44:23 +0000 (15:44 +0100)
include/bbcode.php
mod/display.php

index b68a7c5b188ec74c7e181fd9056a2f8e76084fe5..6a44e19ec446e87bcef9b83f53cab95d4af85299 100644 (file)
@@ -3,6 +3,7 @@ require_once("include/oembed.php");
 require_once('include/event.php');
 require_once('include/map.php');
 require_once('mod/proxy.php');
+require_once('include/Contact.php');
 
 function bb_PictureCacheExt($matches) {
        if (strpos($matches[3], "data:image/") === 0)
@@ -541,8 +542,23 @@ function bb_ShareAttributes($share, $simplehtml) {
                $reldate = (($posted) ? " " . relative_date($posted) : '');
        }
 
-       $userid = GetProfileUsername($profile,$author, false);
-       $userid_compact = GetProfileUsername($profile,$author, true);
+       $data = get_contact_details_by_url($profile);
+
+       if (isset($data["name"]) AND isset($data["addr"]))
+               $userid_compact = $data["name"]." (".$data["addr"].")";
+       else
+               $userid_compact = GetProfileUsername($profile,$author, true);
+
+       if (isset($data["addr"]))
+               $userid = $data["addr"];
+       else
+               $userid = GetProfileUsername($profile,$author, false);
+
+       if (isset($data["name"]))
+               $author = $data["name"];
+
+       if (isset($data["photo"]))
+               $avatar = $data["photo"];
 
        $preshare = trim($share[1]);
 
index 41cad5c6a92c81bd107b84d3a85f4df4500922bc..c41d2f045fcf7ff4b6b2c0204175193737cdcb45 100644 (file)
@@ -158,23 +158,25 @@ function display_fetchauthor($a, $item) {
        $showdetails = ($profiledata["network"] != NETWORK_DIASPORA);
 
        // Fetching further contact data from the contact table
-       $r = q("SELECT `uid`, `network`, `photo`, `nick`, `addr`, `location`, `about`, `gender`, `keywords`
+       $r = q("SELECT `uid`, `network`, `name`, `photo`, `nick`, `addr`, `location`, `about`, `gender`, `keywords`
                FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d AND `network` = '%s' AND `rel` IN (%d, %d)",
-               dbesc(normalise_link($profiledata["url"])), intval($item["uid"]), dbesc($item["network"]),
+               dbesc(normalise_link($profiledata["url"])), intval(local_user()), dbesc($item["network"]),
                intval(CONTACT_IS_SHARING), intval(CONTACT_IS_FRIEND));
        if (!count($r))
-               $r = q("SELECT `uid`, `network`, `photo`, `nick`, `addr`, `location`, `about`, `gender`, `keywords`
+               $r = q("SELECT `uid`, `network`, `name`, `photo`, `nick`, `addr`, `location`, `about`, `gender`, `keywords`
                        FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d AND `rel` IN (%d, %d)",
-                       dbesc(normalise_link($profiledata["url"])), intval($item["uid"]),
+                       dbesc(normalise_link($profiledata["url"])), intval(local_user()),
                        intval(CONTACT_IS_SHARING), intval(CONTACT_IS_FRIEND));
 
        if (count($r)) {
+               $profiledata["name"] = $r[0]["name"];
                $profiledata["photo"] = $r[0]["photo"];
                $profiledata["nickname"] = $r[0]["nick"];
                $profiledata["addr"] = $r[0]["addr"];
                $profiledata["keywords"] = $r[0]["keywords"];
+               $profiledata["network"] = $r[0]["network"];
 
-               if (($r[0]["uid"] != 0) OR $showdetails) {
+               if (local_user() OR $showdetails) {
                        $showdetails = true;
                        $profiledata["address"] = $r[0]["location"];
                        $profiledata["about"] = $r[0]["about"];
@@ -184,12 +186,14 @@ function display_fetchauthor($a, $item) {
 
        // Fetching profile data from global contacts
        if ($profiledata["network"] != NETWORK_FEED) {
-               $r = q("SELECT `photo`, `nick`, `addr`, `location`, `about`, `gender`, `keywords` FROM `gcontact` WHERE `nurl` = '%s'", dbesc(normalise_link($profiledata["url"])));
+               $r = q("SELECT `name`, `photo`, `nick`, `addr`, `location`, `about`, `gender`, `keywords` FROM `gcontact` WHERE `nurl` = '%s'", dbesc(normalise_link($profiledata["url"])));
                if (count($r)) {
+                       $profiledata["name"] = $r[0]["name"];
                        $profiledata["photo"] = $r[0]["photo"];
                        $profiledata["nickname"] = $r[0]["nick"];
                        $profiledata["addr"] = $r[0]["addr"];
                        $profiledata["keywords"] = $r[0]["keywords"];
+                       $profiledata["network"] = $r[0]["network"];
 
                        if ($showdetails) {
                                $profiledata["address"] = $r[0]["location"];