If a user is already connected to another user, then don't show the "connect" link on his profile.
This commit is contained in:
parent
d23d26f44d
commit
53dcecd596
30
boot.php
30
boot.php
|
@ -1482,12 +1482,11 @@ if(! function_exists('profile_sidebar')) {
|
||||||
|
|
||||||
call_hooks('profile_sidebar_enter', $profile);
|
call_hooks('profile_sidebar_enter', $profile);
|
||||||
|
|
||||||
|
|
||||||
// don't show connect link to yourself
|
// don't show connect link to yourself
|
||||||
$connect = (($profile['uid'] != local_user()) ? t('Connect') : False);
|
$connect = (($profile['uid'] != local_user()) ? t('Connect') : False);
|
||||||
|
|
||||||
// don't show connect link to authenticated visitors either
|
// don't show connect link to authenticated visitors either
|
||||||
|
|
||||||
if(remote_user() && count($_SESSION['remote'])) {
|
if(remote_user() && count($_SESSION['remote'])) {
|
||||||
foreach($_SESSION['remote'] as $visitor) {
|
foreach($_SESSION['remote'] as $visitor) {
|
||||||
if($visitor['uid'] == $profile['uid']) {
|
if($visitor['uid'] == $profile['uid']) {
|
||||||
|
@ -1497,20 +1496,28 @@ if(! function_exists('profile_sidebar')) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Is the local user already connected to that user?
|
||||||
|
if ($connect AND local_user()) {
|
||||||
|
$profile_url = normalise_link($a->get_baseurl()."/profile/".$profile["nickname"]);
|
||||||
|
|
||||||
|
$r = q("SELECT * FROM `contact` WHERE NOT `pending` AND `uid` = %d AND `nurl` = '%s'",
|
||||||
|
local_user(), $profile_url);
|
||||||
|
if (count($r))
|
||||||
|
$connect = false;
|
||||||
|
}
|
||||||
|
|
||||||
if( get_my_url() && $profile['unkmail'] && ($profile['uid'] != local_user()) )
|
if( get_my_url() && $profile['unkmail'] && ($profile['uid'] != local_user()) )
|
||||||
$wallmessage = t('Message');
|
$wallmessage = t('Message');
|
||||||
else
|
else
|
||||||
$wallmessage = false;
|
$wallmessage = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// show edit profile to yourself
|
// show edit profile to yourself
|
||||||
if ($profile['uid'] == local_user() && feature_enabled(local_user(),'multi_profiles')) {
|
if ($profile['uid'] == local_user() && feature_enabled(local_user(),'multi_profiles')) {
|
||||||
$profile['edit'] = array($a->get_baseurl(). '/profiles', t('Profiles'),"", t('Manage/edit profiles'));
|
$profile['edit'] = array($a->get_baseurl(). '/profiles', t('Profiles'),"", t('Manage/edit profiles'));
|
||||||
|
|
||||||
$r = q("SELECT * FROM `profile` WHERE `uid` = %d",
|
$r = q("SELECT * FROM `profile` WHERE `uid` = %d",
|
||||||
local_user());
|
local_user());
|
||||||
|
|
||||||
$profile['menu'] = array(
|
$profile['menu'] = array(
|
||||||
'chg_photo' => t('Change profile photo'),
|
'chg_photo' => t('Change profile photo'),
|
||||||
'cr_new' => t('Create New Profile'),
|
'cr_new' => t('Create New Profile'),
|
||||||
|
@ -1535,18 +1542,15 @@ if(! function_exists('profile_sidebar')) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($profile['uid'] == local_user() && !feature_enabled(local_user(),'multi_profiles')) {
|
if ($profile['uid'] == local_user() && !feature_enabled(local_user(),'multi_profiles')) {
|
||||||
$profile['edit'] = array($a->get_baseurl(). '/profiles/'.$profile['id'], t('Edit profile'),"", t('Edit profile'));
|
$profile['edit'] = array($a->get_baseurl(). '/profiles/'.$profile['id'], t('Edit profile'),"", t('Edit profile'));
|
||||||
$profile['menu'] = array(
|
$profile['menu'] = array(
|
||||||
'chg_photo' => t('Change profile photo'),
|
'chg_photo' => t('Change profile photo'),
|
||||||
'cr_new' => null,
|
'cr_new' => null,
|
||||||
'entries' => array(),
|
'entries' => array(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if((x($profile,'address') == 1)
|
if((x($profile,'address') == 1)
|
||||||
|| (x($profile,'locality') == 1)
|
|| (x($profile,'locality') == 1)
|
||||||
|| (x($profile,'region') == 1)
|
|| (x($profile,'region') == 1)
|
||||||
|
|
Loading…
Reference in a new issue