X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModel%2FProfile.php;h=cb2754cc80ce6a8ef218421ec7952ccb00327fed;hb=505350c9fb9b16dde6c86d418947592ab3720282;hp=f6e116fa79867b94a9cbb58d5bc0541446898155;hpb=47c2565917bb0f190ef9374d261e538c424b210c;p=friendica.git diff --git a/src/Model/Profile.php b/src/Model/Profile.php index f6e116fa79..cb2754cc80 100644 --- a/src/Model/Profile.php +++ b/src/Model/Profile.php @@ -28,6 +28,19 @@ require_once 'include/dba.php'; 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 * @@ -361,7 +374,7 @@ class Profile 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']; } @@ -492,7 +505,7 @@ class Profile if (isset($p['address'])) { $p['address'] = BBCode::convert($p['address']); - } else { + } elseif (isset($p['location'])) { $p['address'] = BBCode::convert($p['location']); }