Fetching "location" and "about" from diaspora. Displaying them on the "display" page.
This commit is contained in:
parent
a2a393a3c6
commit
b36d799044
7 changed files with 40 additions and 31 deletions
|
@ -16,7 +16,7 @@ function display_init(&$a) {
|
|||
|
||||
// Does the local user have this item?
|
||||
if (local_user()) {
|
||||
$r = q("SELECT `id`, `parent`, `author-name`, `author-link`, `author-avatar`, `network`, `body` FROM `item`
|
||||
$r = q("SELECT `id`, `parent`, `author-name`, `author-link`, `author-avatar`, `network`, `body`, `uid` FROM `item`
|
||||
WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0
|
||||
AND `guid` = '%s' AND `uid` = %d", $a->argv[1], local_user());
|
||||
if (count($r)) {
|
||||
|
@ -43,7 +43,7 @@ function display_init(&$a) {
|
|||
}
|
||||
if (count($r)) {
|
||||
if ($r[0]["id"] != $r[0]["parent"])
|
||||
$r = q("SELECT `id`, `author-name`, `author-link`, `author-avatar`, `network`, `body` FROM `item`
|
||||
$r = q("SELECT `id`, `author-name`, `author-link`, `author-avatar`, `network`, `body`, `uid` FROM `item`
|
||||
WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0
|
||||
AND `id` = %d", $r[0]["parent"]);
|
||||
|
||||
|
@ -88,21 +88,22 @@ function display_fetchauthor($a, $item) {
|
|||
$profiledata["photo"] = proxy_url($item["author-avatar"]);
|
||||
$profiledata["url"] = $item["author-link"];
|
||||
$profiledata["network"] = $item["network"];
|
||||
$profiledata["address"] = "Ort".print_r($item, true);
|
||||
|
||||
// Fetching profile data from unique contacts
|
||||
// To-do: Extend "unique contacts" table for further contact data like location, ...
|
||||
$r = q("SELECT `avatar`, `nick` FROM `unique_contacts` WHERE `url` = '%s'", normalise_link($profiledata["url"]));
|
||||
// Fetching further contact data from the contact table
|
||||
$r = q("SELECT `photo`, `nick`, `location`, `about` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d",
|
||||
normalise_link($profiledata["url"]), $item["uid"]);
|
||||
if (count($r)) {
|
||||
$profiledata["photo"] = proxy_url($r[0]["avatar"]);
|
||||
$profiledata["photo"] = proxy_url($r[0]["photo"]);
|
||||
$profiledata["address"] = $r[0]["location"];
|
||||
$profiledata["about"] = $r[0]["about"];
|
||||
if ($r[0]["nick"] != "")
|
||||
$profiledata["nickname"] = $r[0]["nick"];
|
||||
} else {
|
||||
// Is this case possible?
|
||||
// Fetching further contact data from the contact table, when it isn't available in the "unique contacts"
|
||||
$r = q("SELECT `photo`, `nick` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d",
|
||||
normalise_link($profiledata["url"]), $itemuid);
|
||||
// Fetching profile data from unique contacts
|
||||
$r = q("SELECT `avatar`, `nick` FROM `unique_contacts` WHERE `url` = '%s'", normalise_link($profiledata["url"]));
|
||||
if (count($r)) {
|
||||
$profiledata["photo"] = proxy_url($r[0]["photo"]);
|
||||
$profiledata["photo"] = proxy_url($r[0]["avatar"]);
|
||||
if ($r[0]["nick"] != "")
|
||||
$profiledata["nickname"] = $r[0]["nick"];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue