Uutiset:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu
Advertisement:

hide email addresses by default

Aloittaja crawman, kesäkuu 02, 2011, 01:14:36 IP

« edellinen - seuraava »

crawman

Is there any way to hide email addresses in the profile by default in a 1.1.13 forum?

I've been reading and the only way I (without installing a mod) is to have each person hide their email in their profile (which is not really an option for this particular forum).

If a mod is the only way- can anyone recommend a mod?

Thanks in advance

Sir Osis of Liver


This should do it.

In Profile.template.php

Find this:



// Only show the email address if it's not hidden.
if ($context['member']['email_public'])
echo '
<a href="mailto:', $context['member']['email'], '">', $context['member']['email'], '</a>';
// ... Or if the one looking at the profile is an admin they can see it anyway.
elseif (!$context['member']['hide_email'])
echo '
<i><a href="mailto:', $context['member']['email'], '">', $context['member']['email'], '</a></i>';
else
echo '
<i>', $txt[722], '</i>';




Change it to this:



/// Only show the email address to admins.
// if ($context['member']['email_public'])

if ($user_info['groups']['0'] == '1')
echo '
<a href="mailto:', $context['member']['email'], '">', $context['member']['email'], '</a>';

// ... Or if the one looking at the profile is an admin they can see it anyway.
// elseif (!$context['member']['hide_email'])
// echo '
// <i><a href="mailto:', $context['member']['email'], '">', $context['member']['email'], '</a></i>';
else
echo '
<i>', $txt[722], '</i>';




Only admins will see email addresses in profiles; all others will see 'hidden'.

When in Emor, do as the Snamors.
                              - D. Lister

crawman

Thank You VERY much. I'll give it a spin!

Thanks again!

crawman

I'm using a custom theme. Do I put it in display.template.php over the following code?
   



// Don't show the email address if they want it hidden.
if (empty($message['member']['hide_email']))
echo '
<a href="mailto:', $message['member']['email'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/email_sm.gif" alt="' . $txt[69] . '" title="' . $txt[69] . '" border="0" />' : $txt[69]), '</a>';

Sir Osis of Liver

#4
Attach your Profile.template.php and Display.template.php, and I'll have a look.  Which theme are you using?

When in Emor, do as the Snamors.
                              - D. Lister

crawman

Here is the Display.template.php from the custom theme that is running called "BisdakWorldClassic" and the Profile.template.php from the default theme.

Thanks again for your help!

Sir Osis of Liver

Ok, it's actually two different things.  The code for Profile.template.php will hide all email addresses for all members in member profile - only admins can see them.  Display.template.php shows the email icon in the user post info panel, unless email is hidden by member.  The email address is displayed in the browser status bar when you mouseover the icon, and in the mail client when you click the icon, so you have to remove the email icon altogether.  Members can always pm each other, so it's not a problem.

If you want to eliminate the email icon altogether, in Display.template.php -

Find this:



// Don't show the email address if they want it hidden.
if (empty($message['member']['hide_email']))
echo '
<a href="mailto:', $message['member']['email'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/email_sm.gif" alt="' . $txt[69] . '" title="' . $txt[69] . '" border="0" />' : $txt[69]), '</a>';




and delete it (or comment it out until you're sure).

If you want admins only to see the mail icon, change it to this:



/// Don't show the email icon except to admins.
if (empty($message['member']['hide_email']) && $user_info['groups']['0'] == '1')
echo '
<a href="mailto:', $message['member']['email'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/email_sm.gif" alt="' . $txt[69] . '" title="' . $txt[69] . '" border="0" />' : $txt[69]), '</a>';

When in Emor, do as the Snamors.
                              - D. Lister

Aleksi "Lex" Kilpinen

Hi crawman, any updates to this - do you still need assistance with this? :)
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Advertisement: