Previous Thread
Next Thread
Print Thread
Rate Thread
#313342 03/03/2007 9:46 AM
Joined: Oct 2001
Posts: 139
Journeyman
Journeyman
Joined: Oct 2001
Posts: 139
First, I hope I am allowed to post a MOD here. Since I have a New Topic Button available I assumed it was ok. If not, feel free to delete. Anyway, as you know, when someone posts an email in a post, if it's a forum that guests can read, then you know that SPAM bots can also read it, right? Well, years ago I had a Mod in my old Threads 6.X that someone else wrote which would hide any email addresses in posts unless you were logged in. If you were not logged in, all you would see was [login to view email] (or whatever message you want). So I can't take full credit for this MOD because I only modified it to work with 7.1 - and it works great! (It may work with other versions as well).

Ok, first, as you know, there are two ways a member can post an email in a post and they both require different methods to "hide" from the spam bots. The first method is when a member just types in the email directly in the post (does not use the "Mail" icon). In this case, we want to replace the "@" with a picture of an "@", So, simply make a small .gif of an "@" and put it in your appropriate images directory on your server. Then, in the Features Settings in the Control Panel, go to the Active Text tab and put this (I'm using PhP tags, but I know this isn't PhP):
PHP Code
 @|<img src="http://www.yourwebsite.com/yourforumdir/images/general/default/atsign.gif">



(Replace yourwebsite with your domain name and yourforumdir with the name of the directiry for your Threads install)

This way, if someone types in an email address directly in a post, the members can still "see" the email address, but the "@" is replaced with an image so the email address is not clickable, but also SPAM bots don't see it as an email address.

Ok, the second way a member can put an email address in a post is to use the "Mail" icon in the edit buttons. This works a little different and requires some code added to your showflat.inc.php file in the /scripts dir. (This assumes that your default style is "showflat" and not "Threaded" because the spam bots will see threads in flat mode if that is the default. I suspect a similer mod can be made to showthreaded.inc.php if necessary.

In showflat.inc.php, find this piece of code:

PHP Code

// ---------------------------
// Do they get an edit button?

$edit_now = time();
$edit_window = $config['MAX_EDIT_TIME'] * 60;



Then, just above that , add this code:

PHP Code

// DO WE HIDE MAIL FROM NON-LOGGED IN?
if(!$user['USER_DISPLAY_NAME'] || $user['USER_DISPLAY_NAME']==""){
$Body = preg_replace("/<a href=("|")mailto:(.*?)("|")>(.*?)<\/a>/i","<B>[Login to view email]</B>",$Body);
}


You can change the [Login to view email] to whatever you want it to say. This is what a guest (or spam bot) will see if someone has used the mail button to post a "mailto:" email address in a post. Anyone who is logged in of course, will see the actual email address (and it will be clickable).

Hope this is useful. I feel that protecting email addresses in posts from spam bots a a good service to provide to our members.

Basil

Sponsored Links
Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
Thanks for sharing, shoud be standard in ubb.threads smile


- Allen wavey
- What Drives You?
Joined: Oct 2001
Posts: 139
Journeyman
Journeyman
Joined: Oct 2001
Posts: 139
Originally Posted by AllenAyres
Thanks for sharing, shoud be standard in ubb.threads smile

My pleasure. I agree it should be standard and I've made that request over on UBBCentral. The way I'd like to see it work is, whether a person uses the mail button or just types in an email address directly, it should produce a "mailto:" link like the button does. However, it can only be viewed by members logged in. It would be cool to also have a field in the CP where you could designate what message you want guests (or bots) to see if they view an email address while not logged in.

Basil

Joined: Feb 2002
Posts: 2,286
Veteran
Veteran
Joined: Feb 2002
Posts: 2,286
Thanks Basil - always feel free to post any mods - you do not need to be anything special to do so smile

Thanks again smile


Fans Focus - Focusing on Fans of Sport

(Okay - mainly football (the British variety wink at the moment - but expanding all the time....)

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Gizmo
Gizmo
Portland, OR, USA
Posts: 5,833
Joined: January 2000
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)