News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Hide User Display Names from Guests

Started by Spuds, June 20, 2011, 04:16:53 PM

Previous topic - Next topic

ctec67

$txt['hideusernames'] = 'User name for Guests to see
e.g. Hidden'; $txt['hideusernames'] = 'User name for Guests to see
e.g. Hidden';

Back to 3 lines. Sure hope I don't have to re-install everything.

Matthew K.

Can you attach ./Themes/default/languages/Modifications.english.php without the -utf8 extension please?

ctec67


Matthew K.


ctec67

Yes! That did the trick. :)

So many, many thanks!

Matthew K.


Greybrow

Do you think it would be possible to make it hide names from selected groups and show user title instead?

kiziol

hello, if guests can post in the forum at a time citation can see nick ... how to change it, can anyone help ...

4LP3RUZ1

#28
Got a problem with this mod.

The preg_replace for quotes is acting weird.

I get the hidden name displayed, followed by the profile name.

Example:
http://www.toyotaclubtr.com/index.php?topic=48027.0

I have tried to change the "$3" to "$4" here:

// Quotes, oh my, leave the link just remove the name ....
$reg_ex = '~(<a(?:\s+|\s[^>]*\s)href=[""\']' . preg_quote($scripturl, '~') . '\?topic=(?:[^"]+)?"[^>]*>' . $txt['quote_from'] . ':)(.*?)(' . $txt['on'] . '.*?[^<]+[.]*</a>)~';
$buffer = preg_replace($reg_ex,"$1 " . $modSettings['hideusernames'] . " $3",$buffer);


but that breaks it. Why is it not replacing, but adding?


edit:

Ah ok, nvm. I have parantheses at the end of all user names and apparently this reg-ex doesnt match them. Being a noob on regex, I had to look online and adding (\\(.*\\)) after the (.*?) and then going for "$4" did the trick
Frozen frogs are back :(

4LP3RUZ1

#29
lol, heres me again with what actually was wrong :)

Because I'm using Turkish language files, $txt['on'] is actually empty.

So,

This mod wasn't sectioning the quote tag properly.

What I wrote above worked, because all my members names are in the format "Name Surname (registration number)"

However, there were quote tags from way back, when member names didn't include the numbers and the parentheses.

So now what I did is to change the "$txt['on']" match to look for a space followed by a dash, as it seems to be in all my quote tags just before the date.

I changed (' . $txt['on'] . '.*?[^<]+[.]*</a>)to(\s\-.*?[^<]+[.]*</a>)

Now I'm tackling the "last edited" line...

edit:
in Display.template.php

change the line to look like this:
if ($settings['show_modify'] && !empty($message['modified']['name']) && !$context['user']['is_guest'])...and no more last editors for guests!
Frozen frogs are back :(

Advertisement: