use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI;
-use Friendica\Model\Profile;
use Friendica\Model\User;
/**
$which = $parameters['nick'];
} elseif (local_user() && isset($parameters['profile']) && DI::args()->get(2) == 'view') {
// view infos about a known profile (needs a login)
- $which = $a->user['nickname'];
+ $which = $a->getLoggedInUserNickname();
} else {
System::jsonError(403, 'Authentication required');
}
- $profile = Profile::getByNickname($which);
+ $profile = User::getOwnerDataByNick($which);
if (empty($profile['uid'])) {
System::jsonError(404, 'Profile not found');
$keywords = str_replace(['#', ',', ' ', ',,'], ['', ' ', ',', ','], $keywords);
$keywords = explode(',', $keywords);
- $contactPhoto = DBA::selectFirst('contact', ['photo'], ['self' => true, 'uid' => $profile['uid']]);
-
$json_info['fn'] = $profile['name'];
- $json_info['photo'] = $contactPhoto["photo"];
+ $json_info['photo'] = User::getAvatarUrlForId($profile['uid']);
$json_info['tags'] = $keywords;
$json_info['language'] = $profile['language'];
$json_info['last-activity'] = date('o-W', $last_active);
//These are optional fields.
- $profile_fields = ['about', 'locality', 'region', 'postal-code', 'country-name'];
+ $profile_fields = ['about', 'locality', 'region', 'postal-code', 'country-name', 'xmpp', 'matrix'];
foreach ($profile_fields as $field) {
if (!empty($profile[$field])) {
$json_info["$field"] = $profile[$field];