X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModel%2FProfile.php;h=1437068f92c7068002c0012c8f1eaeb292b52487;hb=7613704d2fa7d81688e697791c2e648f13f7616e;hp=10bd3a1d7542843aaad239c512c4e892bba45b80;hpb=6041f74df64861ae0cab4b6250b97a65f61873a3;p=friendica.git diff --git a/src/Model/Profile.php b/src/Model/Profile.php index 10bd3a1d75..1437068f92 100644 --- a/src/Model/Profile.php +++ b/src/Model/Profile.php @@ -45,6 +45,25 @@ class Profile return $profile; } + /** + * @brief Returns the profile based on a ID + * + * @param int $uid The User ID + * @param int $id The id of the profile (optional) + * @param array $fields The fields to retrieve + * + * @return array Array of profile data + * @throws \Exception + */ + public static function select(int $uid, int $id = null, array $fields = []) + { + if (empty($id)) { + return DBA::selectToArray('profile', $fields, ['uid' => $uid]); + } else { + return DBA::selectFirst('profile', $fields, ['uid' => $uid, 'id' => $id]); + } + } + /** * @brief Returns a formatted location string from the given profile array * @@ -717,7 +736,7 @@ class Profile public static function getAdvanced(App $a) { - $uid = $a->profile['uid']; + $uid = intval($a->profile['uid']); if ($a->profile['name']) { $tpl = Renderer::getMarkupTemplate('profile_advanced.tpl');