class Profile
{
+ /**
+ * @brief Returns default profile for a given user id
+ *
+ * @param integer User ID
+ *
+ * @return array Profile data
+ */
+ public static function getByUID($uid)
+ {
+ $profile = DBA::selectFirst('profile', [], ['uid' => $uid, 'is-default' => true]);
+ return $profile;
+ }
+
/**
* @brief Returns a formatted location string from the given profile array
*
if ($r) {
$remote_url = $r[0]['url'];
$message_path = preg_replace('=(.*)/profile/(.*)=ism', '$1/message/new/', $remote_url);
- $wallmessage_link = $message_path . base64_encode($profile['addr']);
+ $wallmessage_link = $message_path . base64_encode(defaults($profile, 'addr', ''));
} else if (!empty($profile['nickname'])) {
$wallmessage_link = 'wallmessage/' . $profile['nickname'];
}