]> git.mxchange.org Git - friendica.git/blobdiff - include/Contact.php
Merge pull request #2016 from fabrixxm/template_vars_hook
[friendica.git] / include / Contact.php
index 04cf3b43953063dcb835db720f14efb9aaeacd5d..eeb38a5d7a519f031b3e1b3ae939519da55f3632 100644 (file)
@@ -198,12 +198,17 @@ function get_contact_details_by_url($url, $uid = -1) {
        if ($uid == -1)
                $uid = local_user();
 
-       $r = q("SELECT `url`, `name`, `nick`, `addr`. `photo`, `location`, `about`, `keywords`, `gender`, `community`, `network` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
+       $r = q("SELECT `id` AS `gid`, `url`, `name`, `nick`, `addr`, `photo`, `location`, `about`, `keywords`, `gender`, `community`, `network` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
                dbesc(normalise_link($url)));
 
-       if ($r)
+       if ($r) {
                $profile = $r[0];
-       else {
+
+               if ((($profile["addr"] == "") OR ($profile["name"] == "")) AND
+                       in_array($profile["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS)))
+                       proc_run('php',"include/update_gcontact.php", $profile["gid"]);
+
+       } else {
                $r = q("SELECT `url`, `name`, `nick`, `avatar` AS `photo`, `location`, `about` FROM `unique_contacts` WHERE `url` = '%s'",
                        dbesc(normalise_link($url)));