* Returns posts from a given contact url
*
* @param string $contact_url Contact URL
- *
* @param bool $thread_mode
* @param int $update
* @return string posts in HTML
*/
public static function getPostsFromUrl($contact_url, $thread_mode = false, $update = 0)
{
- $a = DI::app();
+ return self::getPostsFromId(self::getIdForURL($contact_url), $thread_mode, $update);
+ }
- $cid = self::getIdForURL($contact_url);
+ /**
+ * Returns posts from a given contact id
+ *
+ * @param integer $cid
+ * @param bool $thread_mode
+ * @param integer $update
+ * @return string posts in HTML
+ * @throws \Exception
+ */
+ public static function getPostsFromId($cid, $thread_mode = false, $update = 0)
+ {
+ $a = DI::app();
$contact = DBA::selectFirst('contact', ['contact-type', 'network'], ['id' => $cid]);
if (!DBA::isResult($contact)) {
$profiledata = Model\Contact::getDetailsByURL($contact['url']);
Model\Profile::load($a, '', $profiledata, true);
- $o .= Model\Contact::getPostsFromUrl($contact['url'], true, $update);
+
+ if ($contact['uid'] == 0) {
+ $o .= Model\Contact::getPostsFromId($contact['id'], true, $update);
+ } else {
+ $o .= Model\Contact::getPostsFromUrl($contact['url'], true, $update);
+ }
}
return $o;
}
Model\Profile::load($a, '', $profiledata, true);
- $o .= Model\Contact::getPostsFromUrl($contact['url']);
+
+ if ($contact['uid'] == 0) {
+ $o .= Model\Contact::getPostsFromId($contact['id']);
+ } else {
+ $o .= Model\Contact::getPostsFromUrl($contact['url']);
+ }
}
return $o;