Better detection for remote user
This commit is contained in:
parent
0a617da044
commit
e4ec867df3
1 changed files with 17 additions and 10 deletions
|
@ -246,19 +246,26 @@ function profile_sidebar($profile, $block = 0) {
|
||||||
else
|
else
|
||||||
$subscribe_feed = false;
|
$subscribe_feed = false;
|
||||||
|
|
||||||
if(get_my_url() && $profile['unkmail'] && ($profile['uid'] != local_user())) {
|
if (remote_user() OR (get_my_url() && $profile['unkmail'] && ($profile['uid'] != local_user()))) {
|
||||||
$wallmessage = t('Message');
|
$wallmessage = t('Message');
|
||||||
|
$wallmessage_link = "wallmessage/".$profile["nickname"];
|
||||||
|
|
||||||
$r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `nurl` = '%s' AND `rel` = %d",
|
if (remote_user()) {
|
||||||
intval($profile['uid']),
|
$r = q("SELECT `url` FROM `contact` WHERE `uid` = %d AND `id` = '%s' AND `rel` = %d",
|
||||||
dbesc(normalise_link(get_my_url())),
|
intval($profile['uid']),
|
||||||
intval(CONTACT_IS_FRIEND));
|
intval(remote_user()),
|
||||||
|
intval(CONTACT_IS_FRIEND));
|
||||||
|
} else {
|
||||||
|
$r = q("SELECT `url` FROM `contact` WHERE `uid` = %d AND `nurl` = '%s' AND `rel` = %d",
|
||||||
|
intval($profile['uid']),
|
||||||
|
dbesc(normalise_link(get_my_url())),
|
||||||
|
intval(CONTACT_IS_FRIEND));
|
||||||
|
}
|
||||||
if ($r) {
|
if ($r) {
|
||||||
$message_path = preg_replace("=(.*)/profile/(.*)=ism", "$1/message/new/", get_my_url());
|
$remote_url = $r[0]["url"];
|
||||||
$wallmessage_link = $message_path.base64_encode(get_my_url());
|
$message_path = preg_replace("=(.*)/profile/(.*)=ism", "$1/message/new/", $remote_url);
|
||||||
} else
|
$wallmessage_link = $message_path.base64_encode($remote_url);
|
||||||
$wallmessage_link = "wallmessage/".$profile["nickname"];
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$wallmessage = false;
|
$wallmessage = false;
|
||||||
$wallmessage_link = false;
|
$wallmessage_link = false;
|
||||||
|
|
Loading…
Reference in a new issue