Merge pull request #4151 from annando/connect-follow

Don't show the connect link in the profile on the "follow" page
This commit is contained in:
Hypolite Petovan 2017-12-29 17:49:44 -06:00 committed by GitHub
commit 6d6d83012c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 15 deletions

View file

@ -41,8 +41,9 @@ require_once 'mod/proxy.php';
* @param string $nickname string * @param string $nickname string
* @param int $profile int * @param int $profile int
* @param array $profiledata array * @param array $profiledata array
* @param boolean $show_connect Show connect link
*/ */
function profile_load(App $a, $nickname, $profile = 0, $profiledata = array()) function profile_load(App $a, $nickname, $profile = 0, $profiledata = array(), $show_connect = true)
{ {
$user = q( $user = q(
"SELECT `uid` FROM `user` WHERE `nickname` = '%s' LIMIT 1", "SELECT `uid` FROM `user` WHERE `nickname` = '%s' LIMIT 1",
@ -115,7 +116,7 @@ function profile_load(App $a, $nickname, $profile = 0, $profiledata = array())
); );
} }
$block = (((Config::get('system', 'block_public')) && (! local_user()) && (! remote_user())) ? true : false); $block = ((Config::get('system', 'block_public') && !local_user() && !remote_user()) ? true : false);
/** /**
* @todo * @todo
@ -123,9 +124,9 @@ function profile_load(App $a, $nickname, $profile = 0, $profiledata = array())
* But: When this profile was on the same server, then we could display the contacts * But: When this profile was on the same server, then we could display the contacts
*/ */
if ($profiledata) { if ($profiledata) {
$a->page['aside'] .= profile_sidebar($profiledata, true); $a->page['aside'] .= profile_sidebar($profiledata, true, $show_connect);
} else { } else {
$a->page['aside'] .= profile_sidebar($a->profile, $block); $a->page['aside'] .= profile_sidebar($a->profile, $block, $show_connect);
} }
/*if (! $block) /*if (! $block)
@ -206,6 +207,7 @@ function get_profiledata_by_nick($nickname, $uid = 0, $profile = 0)
* *
* @param array $profile * @param array $profile
* @param int $block * @param int $block
* @param boolean $show_connect Show connect link
* *
* @return HTML string stuitable for sidebar inclusion * @return HTML string stuitable for sidebar inclusion
* *
@ -216,7 +218,7 @@ function get_profiledata_by_nick($nickname, $uid = 0, $profile = 0)
* @hooks 'profile_sidebar' * @hooks 'profile_sidebar'
* array $arr * array $arr
*/ */
function profile_sidebar($profile, $block = 0) function profile_sidebar($profile, $block = 0, $show_connect = true)
{ {
$a = get_app(); $a = get_app();
@ -256,6 +258,10 @@ function profile_sidebar($profile, $block = 0)
} }
} }
if (!$show_connect) {
$connect = false;
}
// Is the local user already connected to that user? // Is the local user already connected to that user?
if ($connect && local_user()) { if ($connect && local_user()) {
if (isset($profile["url"])) { if (isset($profile["url"])) {

View file

@ -176,7 +176,8 @@ function follow_content(App $a) {
)); ));
$a->page['aside'] = ""; $a->page['aside'] = "";
profile_load($a, "", 0, Contact::getDetailsByURL($ret["url"]));
profile_load($a, "", 0, Contact::getDetailsByURL($ret["url"]), false);
if ($gcontact_id <> 0) { if ($gcontact_id <> 0) {
$o .= replace_macros(get_markup_template('section_title.tpl'), $o .= replace_macros(get_markup_template('section_title.tpl'),