When showing posts for a contact we have to tread forums in a special way
This commit is contained in:
parent
2ac3db7607
commit
5d0e7d24ba
|
@ -786,22 +786,25 @@ function posts_from_contact_url(App $a, $contact_url) {
|
||||||
|
|
||||||
// There are no posts with "uid = 0" with connector networks
|
// There are no posts with "uid = 0" with connector networks
|
||||||
// This speeds up the query a lot
|
// This speeds up the query a lot
|
||||||
$r = q("SELECT `network`, `id` AS `author-id` FROM `contact`
|
$r = q("SELECT `network`, `id` AS `author-id`, `contact-type` FROM `contact`
|
||||||
WHERE `contact`.`nurl` = '%s' AND `contact`.`uid` = 0",
|
WHERE `contact`.`nurl` = '%s' AND `contact`.`uid` = 0",
|
||||||
dbesc(normalise_link($contact_url)));
|
dbesc(normalise_link($contact_url)));
|
||||||
|
|
||||||
|
if (!dbm::is_result($r)) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
if (in_array($r[0]["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, ""))) {
|
if (in_array($r[0]["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, ""))) {
|
||||||
$sql = "(`item`.`uid` = 0 OR (`item`.`uid` = %d AND NOT `item`.`global`))";
|
$sql = "(`item`.`uid` = 0 OR (`item`.`uid` = %d AND NOT `item`.`global`))";
|
||||||
} else {
|
} else {
|
||||||
$sql = "`item`.`uid` = %d";
|
$sql = "`item`.`uid` = %d";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dbm::is_result($r)) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$author_id = intval($r[0]["author-id"]);
|
$author_id = intval($r[0]["author-id"]);
|
||||||
|
|
||||||
$r = q(item_query()." AND `item`.`author-id` = %d AND ".$sql.
|
$contact = ($r[0]["contact-type"] = ACCOUNT_TYPE_COMMUNITY ? 'owner-id' : 'author-id');
|
||||||
|
|
||||||
|
$r = q(item_query()." AND `item`.`".$contact."` = %d AND ".$sql.
|
||||||
" ORDER BY `item`.`created` DESC LIMIT %d, %d",
|
" ORDER BY `item`.`created` DESC LIMIT %d, %d",
|
||||||
intval($author_id),
|
intval($author_id),
|
||||||
intval(local_user()),
|
intval(local_user()),
|
||||||
|
|
Loading…
Reference in a new issue