Helpful Information
 
 
Category: Programming Articles
How to 'Hide' the member's URL throughout the forum

Hello.

Some forum admins don't want to allow their members to indirectly 'advertise' nor do they want to have to monitor WHERE members are linking to through their USERCP panel therefore, the question has been raised in the vB forum re: how to hide the URL. Here's my take on it...

To hide the member 'Homepage URL' thus preventing it from being an option, here's what I've discovered:

there are 2 template files that control the homepage URL:

(1) Modify User Option Templates->modifyprofile
AND
(2) Member Info Templates->MEMBERINFO.

Note: hacking of the 'member.php' file is not needed to do this

'MEMBERINFO' template controls the look, etc. of the 'View Profile' page that comes up when someone clicks on a member's name e.g. in a post or elsewhere, and then selects 'View Public Profile'.. This means, it USES the profile information IF the data is available. If a profile field is empty, this page treats that field as if it is non-existent.

The data originates from USERCP->edit profile. The 'modifyprofile' template controls the look, etc. for this portion of the page. From what I can tell, this is the only place that requires editing to hide the 'Homepage URL' since if the data doesn't exist here, it won't exist anywhere else (of course, unless the URL field is added to the default fields in the registration page in the future - hope not; hopefully, it becomes an option in AdminCP, though).

To hide the URL field, in the 'modifyprofile' template, find the homepage-related section that's surrounded by the <fieldset..> </fieldset> tags. You can do a template search for 'homepage' to find this section of code.

Once there, you have 2 basic options but several ways to accomplish them. Option 1 is to hide the code so that the field is hidden in USERCP->edit profile and therefore uneditable to the user but it's code is visible via the browser's 'View Source'. To do this, surround the code with comment tags (<!-- before the code and --> after the code)

Option 2 is a slight revision to Option 1 whereby the code is to be hidden from the browser's 'View Source'. I prefer Option 2 therefore, that's the one I'll present here. (Note: this method is arbitrary; you may choose to use a different method that accomplishes the same result)

Step 1:
go to AdminCP->Plugin Manager->[Add New Plugin] ->fill in the fields using 'Hook Location' of 'global_start', etc. In the 'Plugin PHP Code' box, add the following variable (without the quotes shown here), e.g. '$show_homepage=0;' (I like to use '0' and '1' to represent 'off' and 'on', respectively, though any value you chose can be used). Select 'Yes' for 'Plugin is Active' so this variable now becomes available throughout your vBulletin forum.

Step 2:
on the line BEFORE the <fieldset> tag to the 'Homepage URL' code section, ADD the following code:

'<if condition="$show_homepage==1">'
and AFTER the matching </fieldset>
ADD '</if>' again without the quotes.

Since from the plugin, the '$show_homepage' is not equal to 1, this statement renders 'false' and therefore, the data between the <if...></if> tags won't be interpreted/evaluated.

NOTE: If at anytime in the future you want the 'Homepage URL' to show again, go back to the 'Plugin Manager' and change the variable from '0' (off) to '1' (on). This essentially acts like an 'ON/OFF' switch. No code modification would be required.

If you want to make a note in this template to remind yourself where you made the revision e.g. if you have to revert the template in the future due to a vB upgrade, etc., use 'comment' tags e.g.

<!-- begin revision -->
<if...>
<fieldset>
...
</fieldset>
</if>
<!-- end revision -->

On the browser's 'View Source', you'll just see the comment code with nothing in-between.

Make sure you have a backup copy (file or hardcopy) of the revised template. :nervous:

Step 3:
Save the template and then go to the 'USERCP->edit profile' and that field should no longer exist, nor should it show up on the 'View Profile' page.

Hope this helps. :squareeyed:

It'd rather go to tutorial forum. :)

It'd rather go to tutorial forum. :)

Moved to the correct forum. :)










privacy (GDPR)