Fix Message button.
This commit is contained in:
parent
35444a0e2b
commit
fe52719d37
1 changed files with 12 additions and 3 deletions
|
@ -145,7 +145,7 @@ class Profile
|
||||||
*/
|
*/
|
||||||
public static function load(App $a, $nickname, array $profiledata = [], $show_connect = true)
|
public static function load(App $a, $nickname, array $profiledata = [], $show_connect = true)
|
||||||
{
|
{
|
||||||
$user = DBA::selectFirst('user', ['uid'], ['nickname' => $nickname, 'account_removed' => false]);
|
$user = DBA::selectFirst('user', [], ['nickname' => $nickname, 'account_removed' => false]);
|
||||||
|
|
||||||
if (!DBA::isResult($user) && empty($profiledata)) {
|
if (!DBA::isResult($user) && empty($profiledata)) {
|
||||||
Logger::log('profile error: ' . DI::args()->getQueryString(), Logger::DEBUG);
|
Logger::log('profile error: ' . DI::args()->getQueryString(), Logger::DEBUG);
|
||||||
|
@ -166,7 +166,16 @@ class Profile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$profile = !empty($user['uid']) ? User::getOwnerDataById($user['uid'], false) : [];
|
if (empty($user['uid'])) {
|
||||||
|
$profile = [];
|
||||||
|
} else {
|
||||||
|
$profile = array_merge(
|
||||||
|
$user,
|
||||||
|
Profile::getByUID($user['uid']),
|
||||||
|
Contact::getById(Contact::getIdForURL(Strings::normaliseLink(DI::baseurl() . '/profile/' . $nickname), local_user()))
|
||||||
|
);
|
||||||
|
$profile['cid'] = $profile['id'];
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($profile) && empty($profiledata)) {
|
if (empty($profile) && empty($profiledata)) {
|
||||||
Logger::log('profile error: ' . DI::args()->getQueryString(), Logger::DEBUG);
|
Logger::log('profile error: ' . DI::args()->getQueryString(), Logger::DEBUG);
|
||||||
|
@ -334,7 +343,7 @@ class Profile
|
||||||
|
|
||||||
if (Contact::canReceivePrivateMessages($profile)) {
|
if (Contact::canReceivePrivateMessages($profile)) {
|
||||||
if ($visitor_is_followed || $visitor_is_following) {
|
if ($visitor_is_followed || $visitor_is_following) {
|
||||||
$wallmessage_link = $visitor_base_path . '/message/new/' . base64_encode($profile['addr'] ?? '');
|
$wallmessage_link = $visitor_base_path . '/message/new/' . $profile['cid'];
|
||||||
} elseif ($visitor_is_authenticated && !empty($profile['unkmail'])) {
|
} elseif ($visitor_is_authenticated && !empty($profile['unkmail'])) {
|
||||||
$wallmessage_link = 'wallmessage/' . $profile['nickname'];
|
$wallmessage_link = 'wallmessage/' . $profile['nickname'];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue