• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Hiding "Home page" profile field from guests (spamming issue)

CTXMedia

Formerly CyclingTribe
#1
I've got the same problem on all my XF boards where spammers register and add their spam URL to their profile home page field - which is then displayed to everyone.

How would I hide this field from guests (and/or selected usergroup IDs) so that the URLs are not spidered by search engine bots?

Thanks,
Shaun :D
 

Chris D

XenForo developer
Staff member
#2
The URLs won't be followed by search engines as they have the nofollow attribute set.

EDIT: To answer your question though.

member_view template change:

Code:
<xen:if is="{$user.homepage}">
<dt>{xen:phrase home_page}:</dt>​
<dd><a href="{xen:string censor, $user.homepage, 'x'}" rel="nofollow" target="_blank" itemprop="url">{xen:string censor, $user.homepage}</a></dd>​
</xen:if>
to:

Code:
<xen:if is="{$user.homepage} AND {xen:helper ismemberof, $visitor, 3, 4, 5}">
<dt>{xen:phrase home_page}:</dt>​
<dd><a href="{xen:string censor, $user.homepage, 'x'}" rel="nofollow" target="_blank" itemprop="url">{xen:string censor, $user.homepage}</a></dd>​
</xen:if>
Where "3, 4, 5" are usergroup IDs.
 

Simon

Active member
#4
I have the same problem and thanks for the code above. This does remove the homepage from displaying in the left hand side of the user profile. However, I have also noticed that the home page URL is also displayed in the information tab in the user profile and the recent activity tab. I guess to stop the spam the easiest way would be to block the user from entering it altogether.

Any idea on what template I need to edit and some example code?

Thanks in advance.

Simon

Update: I edited template account_personal_details template and removed:
Code:
<dl class="ctrlUnit">
            <dt><label for="ctrl_homepage">{xen:phrase home_page}:</label></dt>
            <dd><input type="url" name="homepage" value="{$visitor.homepage}" id="ctrl_homepage" class="textCtrl" /></dd>
        </dl>
This removed the option to add a homepage for all users.
I just need to figure out a way to add a usergroup condtion to add the code back.
 

Chris D

XenForo developer
Staff member
#5
It could be removed from that tab too, would just be another template edit somewhere.

Blocking the homepage field though isn't going to prevent spammers. They will still register and they'll put a URL somewhere else, or in their signature, or start a new thread... All that blocking the homepage field will do is potentially frustrate some of your visitors who would use it legitimately.

I take quite a relaxed view of spam on my board. It happens, and it is quite regular, but that's why we have moderators. It's one of those battles you'll never win.

However, if you do want to effectively disable the input, or at least restrict it to more trusted usergroups.

account_personal_details template change:

Code:
<dl class="ctrlUnit">
<dt><label for="ctrl_homepage">{xen:phrase home_page}:</label></dt>​
<dd><input type="url" name="homepage" value="{$visitor.homepage}" id="ctrl_homepage" class="textCtrl" /></dd>​
</dl>
to

Code:
<xen:if is="{xen:helper ismemberof, $visitor, 3, 4, 5}">
<dl class="ctrlUnit">​
<dt><label for="ctrl_homepage">{xen:phrase home_page}:</label></dt>​
<dd><input type="url" name="homepage" value="{$visitor.homepage}" id="ctrl_homepage" class="textCtrl" /></dd>​
</dl>​
</xen:if>
Where 3, 4, 5 are the usergroups who are allowed to edit the homepage field.

By the way, I've not tested either of these, I'm pretty sure they should work, though.
 

CTXMedia

Formerly CyclingTribe
#6
Actually, that's a much better idea - disallowing the editing of the field (controlling which usergroups can see it) would work much better for my boards because I use usergroup promotions and the spammers never graduate past the registered group because they spam and leave.

Thanks Chris, I'll give this a try. (y)

Cheers,
Shaun :D
 

Coop1979

Well-known member
#7
It could be removed from that tab too, would just be another template edit somewhere.

Blocking the homepage field though isn't going to prevent spammers. They will still register and they'll put a URL somewhere else, or in their signature, or start a new thread... All that blocking the homepage field will do is potentially frustrate some of your visitors who would use it legitimately.

I take quite a relaxed view of spam on my board. It happens, and it is quite regular, but that's why we have moderators. It's one of those battles you'll never win.

However, if you do want to effectively disable the input, or at least restrict it to more trusted usergroups.

account_personal_details template change:

Code:
<dl class="ctrlUnit">
<dt><label for="ctrl_homepage">{xen:phrase home_page}:</label></dt>​
<dd><input type="url" name="homepage" value="{$visitor.homepage}" id="ctrl_homepage" class="textCtrl" /></dd>​
</dl>
to

Code:
<xen:if is="{xen:helper ismemberof, $visitor, 3, 4, 5}">
<dl class="ctrlUnit">​
<dt><label for="ctrl_homepage">{xen:phrase home_page}:</label></dt>​
<dd><input type="url" name="homepage" value="{$visitor.homepage}" id="ctrl_homepage" class="textCtrl" /></dd>​
</dl>​
</xen:if>
Where 3, 4, 5 are the usergroups who are allowed to edit the homepage field.

By the way, I've not tested either of these, I'm pretty sure they should work, though.
Chris - What if we just want to exclude 2 usergroups - like "Newly Registered" and "Banned"? Let's say they are groupids 6 and 7.
 

Chris D

XenForo developer
Staff member
#8
Forgive lack of formatting I am on my mobile. It's almost identical but notice the !

This basically says display the field if NOT those groups.

<xen:if is="!{xen:helper ismemberof, $visitor, 6, 7}">
<dl class="ctrlUnit">
<dt><label for="ctrl_homepage">{xen:phrase home_page}:</label></dt>
<dd><input type="url" name="homepage" value="{$visitor.homepage}" id="ctrl_homepage" class="textCtrl" /></dd>
</dl>
</xen:if>
 

NixFifty

Well-known member
#10
I would like to remove the website field from the 'Information' tab. How do I do this?
Remove the following three lines from the member_view template:
HTML:
<xen:if is="{$user.homepage}">
    <dl><dt>{xen:phrase home_page}:</dt> <dd><a href="{xen:string censor, $user.homepage, 'x'}" rel="nofollow" target="_blank">{xen:string censor, $user.homepage}</a></dd></dl>
</xen:if>