Uutiset:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu
Advertisement:

Hide Email addresses by default

Aloittaja Absorb, heinäkuu 22, 2011, 05:53:31 IP

« edellinen - seuraava »

Absorb

Hi all,
I run 1.1.13 and was wondering if it is possible to make all email addresses hidden to all but Administrators.
Is there something I can also do that will also adjust all existing members profiles so that their email addresses will not be seen
Regards
Paul
Working to decrease our dependency on Fossil Fuels with Hydrogen
http://www.reduceyourfuelbill.com.au/forum

shadow82x

Colin B
Former Spammer, Customize, & Support Team Member

Absorb

Great mod, but I want to remove the ability for people to see the email or any contact info when they click on the Members button.

The only way I can see without a mod is going through each member 1 at a time and adjusting their profile with "Email not visible" - Big job with over 750 members
Working to decrease our dependency on Fossil Fuels with Hydrogen
http://www.reduceyourfuelbill.com.au/forum

AK49BWL

#3
You could write a quick script in PHP to do the update job for you using the forum's SSI.. This is rough but should work:

<?php
include $_SERVER['DOCUMENT_ROOT'].'/path/to/forum/SSI.php'// takes care of connecting to mysql

if (!$context['user']['is_admin']) die('Only admins are allowed to run this script.'); // Protect yourself ;)

$query db_query("SELECT ID_MEMBER FROM {$db_prefix}members WHERE hideEmail = 0",__FILE__,__LINE__); // Get current members with un-hidden emails

$numrows mysql_numrows($query); // total found with un-hidden emails
$i=0;

while (
$row mysql_fetch_assoc($query)) {
  
$update db_query("UPDATE {$db_prefix}members SET hideEmail = 1 WHERE ID_MEMBER = '".$row['ID_MEMBER']."'",__FILE__,__LINE__); // Hide the emails!
  
if ($update)
    
$i++;
}

echo 
'A total of '.$i.' changes were made out of the '.$numrows.' found with un-hidden emails.';

?>


Hope this works (and that I'm actually allowed to post something like this...)! I ran it on my server and it worked as intended.

Advertisement: