From: Michael Date: Fri, 29 Dec 2017 22:53:08 +0000 (+0000) Subject: Don't show the connect link in the profile on the "follow" page X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=69d16d9cfa235b5ba9f726aeb7e88c62b0e235e1;p=friendica.git Don't show the connect link in the profile on the "follow" page --- diff --git a/include/identity.php b/include/identity.php index 8f515580f4..79bfe3830b 100644 --- a/include/identity.php +++ b/include/identity.php @@ -41,8 +41,9 @@ require_once 'mod/proxy.php'; * @param string $nickname string * @param int $profile int * @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( "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 @@ -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 */ if ($profiledata) { - $a->page['aside'] .= profile_sidebar($profiledata, true); + $a->page['aside'] .= profile_sidebar($profiledata, true, $show_connect); } else { - $a->page['aside'] .= profile_sidebar($a->profile, $block); + $a->page['aside'] .= profile_sidebar($a->profile, $block, $show_connect); } /*if (! $block) @@ -206,6 +207,7 @@ function get_profiledata_by_nick($nickname, $uid = 0, $profile = 0) * * @param array $profile * @param int $block + * @param boolean $show_connect Show connect link * * @return HTML string stuitable for sidebar inclusion * @@ -216,7 +218,7 @@ function get_profiledata_by_nick($nickname, $uid = 0, $profile = 0) * @hooks 'profile_sidebar' * array $arr */ -function profile_sidebar($profile, $block = 0) +function profile_sidebar($profile, $block = 0, $show_connect = true) { $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? if ($connect && local_user()) { if (isset($profile["url"])) { diff --git a/mod/follow.php b/mod/follow.php index f0cffff4a1..41c008da51 100644 --- a/mod/follow.php +++ b/mod/follow.php @@ -11,8 +11,8 @@ require_once 'include/contact_selectors.php'; function follow_post(App $a) { - if (! local_user()) { - notice( t('Permission denied.') . EOL); + if (!local_user()) { + notice(t('Permission denied.') . EOL); goaway($_SESSION['return_url']); // NOTREACHED } @@ -40,7 +40,7 @@ function follow_post(App $a) { goaway(System::baseUrl().'/contacts/'.$result['cid']); } - info( t('Contact added').EOL); + info(t('Contact added').EOL); if (strstr($return_url,'contacts')) { goaway(System::baseUrl().'/contacts/'.$contact_id); @@ -52,8 +52,8 @@ function follow_post(App $a) { function follow_content(App $a) { - if (! local_user()) { - notice( t('Permission denied.') . EOL); + if (!local_user()) { + notice(t('Permission denied.') . EOL); goaway($_SESSION['return_url']); // NOTREACHED } @@ -81,21 +81,21 @@ function follow_content(App $a) { $ret = Probe::uri($url); if (($ret["network"] == NETWORK_DIASPORA) && !Config::get('system','diaspora_enabled')) { - notice( t("Diaspora support isn't enabled. Contact can't be added.") . EOL); + notice(t("Diaspora support isn't enabled. Contact can't be added.") . EOL); $submit = ""; //goaway($_SESSION['return_url']); // NOTREACHED } if (($ret["network"] == NETWORK_OSTATUS) && Config::get('system','ostatus_disabled')) { - notice( t("OStatus support is disabled. Contact can't be added.") . EOL); + notice(t("OStatus support is disabled. Contact can't be added.") . EOL); $submit = ""; //goaway($_SESSION['return_url']); // NOTREACHED } if ($ret["network"] == NETWORK_PHANTOM) { - notice( t("The network type couldn't be detected. Contact can't be added.") . EOL); + notice(t("The network type couldn't be detected. Contact can't be added.") . EOL); $submit = ""; //goaway($_SESSION['return_url']); // NOTREACHED @@ -116,7 +116,7 @@ function follow_content(App $a) { $r = q("SELECT `url` FROM `contact` WHERE `uid` = %d AND `self` LIMIT 1", intval($uid)); if (!$r) { - notice( t('Permission denied.') . EOL); + notice(t('Permission denied.') . EOL); goaway($_SESSION['return_url']); // NOTREACHED } @@ -176,7 +176,8 @@ function follow_content(App $a) { )); $a->page['aside'] = ""; - profile_load($a, "", 0, Contact::getDetailsByURL($ret["url"])); + + profile_load($a, "", 0, Contact::getDetailsByURL($ret["url"]), false); if ($gcontact_id <> 0) { $o .= replace_macros(get_markup_template('section_title.tpl'),