else
$subscribe_feed = false;
- if(get_my_url() && $profile['unkmail'] && ($profile['uid'] != local_user()))
+ if(get_my_url() && $profile['unkmail'] && ($profile['uid'] != local_user())) {
$wallmessage = t('Message');
- else
+
+ $r = q("SELECT `id` 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) {
+ $message_path = preg_replace("=(.*)/profile/(.*)=ism", "$1/message/new/", get_my_url());
+ $wallmessage_link = $message_path.base64_encode(get_my_url());
+ } else
+ $wallmessage_link = "wallmessage/".$profile["nickname"];
+
+ } else {
$wallmessage = false;
+ $wallmessage_link = false;
+ }
// show edit profile to yourself
if ($profile['uid'] == local_user() && feature_enabled(local_user(),'multi_profiles')) {
'$remoteconnect' => $remoteconnect,
'$subscribe_feed' => $subscribe_feed,
'$wallmessage' => $wallmessage,
+ '$wallmessage_link' => $wallmessage_link,
'$account_type' => $account_type,
'$location' => $location,
'$gender' => $gender,
'$contact_block' => $contact_block,
));
-
$arr = array('profile' => &$profile, 'entry' => &$o);
call_hooks('profile_sidebar', $arr);
$prename = $preurl = $preid = '';
if($preselect) {
- $r = q("select name, url, id from contact where uid = %d and id = %d limit 1",
+ $r = q("SELECT `name`, `url`, `id` FROM `contact` WHERE `uid` = %d AND `id` = %d LIMIT 1",
intval(local_user()),
intval($a->argv[2])
);
+ if(!$r) {
+ $r = q("SELECT `name`, `url`, `id` FROM `contact` WHERE `uid` = %d AND `nurl` = '%s' LIMIT 1",
+ intval(local_user()),
+ dbesc(normalise_link(base64_decode($a->argv[2])))
+ );
+ }
+ if(!$r) {
+ $r = q("SELECT `name`, `url`, `id` FROM `contact` WHERE `uid` = %d AND `addr` = '%s' LIMIT 1",
+ intval(local_user()),
+ dbesc(base64_decode($a->argv[2]))
+ );
+ }
if(count($r)) {
$prename = $r[0]['name'];
$preurl = $r[0]['url'];
$preid = $r[0]['id'];
- }
+ $preselect = array($preid);
+ } else
+ $preselect = false;
}
$prefill = (($preselect) ? $prename : '');
'$wait' => t('Please wait'),
'$submit' => t('Submit')
));
-
return $o;
}