QuackieMackie
New member
This started because I noticed when I tried to limit what unregistered accounts could do, there was nothing for tool tip profiles.
You can block profiles but not the tool tips.
So I went and did that myself. If anyone has any suggestions on how I could make it better that would be amazing.
First off the MemberController extension:
Then
First at the top I add a check if the user is not a guest at the top.
If the user is not a guest it would play out like normal.
At the bottom of the file I add
This then shows a very bare bones version of the tool tip, with the phrase
Finally I add the phrase
This is what it looks like for guests:

You can block profiles but not the tool tips.
So I went and did that myself. If anyone has any suggestions on how I could make it better that would be amazing.
First off the MemberController extension:
PHP:
use XF\Pub\Controller\MemberController as XFMember;
use XF\Mvc\ParameterBag;
class MemberController extends XFMember
{
public function actionTooltip(ParameterBag $params)
{
$this->assertNotEmbeddedImageRequest();
$visitor = \XF::visitor();
if (!$visitor->user_id)
{
$viewParams = [
'isGuest' => true,
];
}
else
{
$user = $this->assertViewableUser($params->user_id, [], true);
$viewParams = [
'user' => $user,
'isGuest' => false
];
}
return $this->view('XF:Member\Tooltip', 'member_tooltip', $viewParams);
}
}
Then
member_tooltip
template modificationsFirst at the top I add a check if the user is not a guest at the top.
HTML:
<xf:css src="member_tooltip.less" />
<xf:if is="!$isGuest">
If the user is not a guest it would play out like normal.
At the bottom of the file I add
HTML:
</xf:if>
<xf:if is="$isGuest">
<div class="memberTooltip">
<div class="memberTooltip-header">
<div class="memberTooltip-headerInfo">
<h4 class="memberTooltip-name">
{{ phrase('only_members_can_view_user_profiles_header') }}
</h4>
</div>
</div>
<div class="memberTooltip-info">
<p class="blockMessage blockMessage--important">
{{ phrase('only_members_can_view_user_profiles') }}
</p>
</div>
</div>
</xf:if>
This then shows a very bare bones version of the tool tip, with the phrase
only_members_can_view_user_profiles
which is translated into Only registered members can view detailed user profiles.
Finally I add the phrase
only_members_can_view_user_profiles_header
with the text Cannot Load
This is what it looks like for guests:

Last edited: