User Vs ...

Do not post support requests, bug reports or feature requests. Discuss phpBB here. Non-phpBB related discussion goes in General Discussion!
Anti-Spam Guide
Pony99CA
Registered User
Posts: 4783
Joined: Thu Sep 30, 2004 3:13 pm
Location: Hollister, CA
Name: Steve
Contact:

Re: User Vs ...

Post by Pony99CA » Wed Sep 17, 2014 12:04 am

cleverwise wrote:
Lumpy Burgertushie wrote:will that have any effect on the word user when used in a post?
Nope. It only effects the word user found in the language files. It won't change user in posts or anywhere else in the code. Plus as I have stated it isn't just user but in any part of a word user appears like username, users, usergroup, etc. :)
So you're doing a code MOD which has run-time costs instead of just using a global search and replace in the language files?

The language files are intended to be edited (that's how translators translate phpBB), so why do a code MOD? That just seems backward to me.

Steve
Silicon Valley Pocket PC (http://www.svpocketpc.com)
Creator of manage_bots and spoof_user (ask me)
Need hosting for a small forum with full cPanel & MySQL access? Contact me or PM me.

User avatar
Sajaki
Registered User
Posts: 1354
Joined: Mon Mar 02, 2009 1:41 pm
Name: Andreas
Contact:

Re: User Vs ...

Post by Sajaki » Wed Sep 17, 2014 8:34 am

You can also use the Word censoring acp to replace "user" with "member". This only works for Forum posts.

cleverwise
Registered User
Posts: 37
Joined: Fri Feb 28, 2014 10:55 pm
Location: Atlanta, GA
Name: Jeremy

Re: User Vs ...

Post by cleverwise » Wed Sep 17, 2014 3:41 pm

Pony99CA wrote:So you're doing a code MOD which has run-time costs instead of just using a global search and replace in the language files?
It was mentioned that this easy method comes at forcing the server to do a find and replace on the language input on each load. So what is gained in easiness taxes the server a bit more. However, having said that, with modern CPUs this is very quick. The most efficient and optimized method? Nope. A major issue with modern computer power? Nope.

True I have spent some time on this, for fun, but the point was provide some code that would quickly change all the references to user (in any part of any word) without the need to spend a bunch of time on the language files. User, in some form (like username, users, user), appears throughout several of the language files, so one would need to hand process a lot of lines to accomplish what this code is doing in less than a second.

So why not use find and replace in Notepad++ or something may come to mind. This is dangerous when you use a computer to force blind changes. It might work for these files as I haven't vetted every line of code but for example if we look at this line from the main index.php file:

Code: Select all

$user->session_begin();
If we blindly replaced user using a global search in say Notepad++ with member we would get:

Code: Select all

$member->session_begin();
This could easily cause the script to fatal out, display errors, or not work in some way.

I say again it may be safe in the language files but we aren't talking about a Word document but code. A semicolon in the wrong place can cause a fatal crash much less altering a key variable or function. A global search and replace could easily modify unintended code.

What my edit does is ONLY replace text defined in the language array. There is no risk of changing important code, like a variable or function name, that phpBB needs to run. That is the difference.
Pony99CA wrote:The language files are intended to be edited (that's how translators translate phpBB), so why do a code MOD? That just seems backward to me.
I agree the point of the language files is to provide a way to alter the text into other languages. Obviously one can still do that. It would be the most efficient server resource wise. However the code provided allows for easier upgrading. Yes the code provided would need to be replaced but what if in the next version a new feature is added or altered that defines a new language entry?

If a translation was done one could easily over look that addition or additions. The above code will automatically alter any new text. Plus the above code can be alter to change user to anything even in other languages like German, French, Spanish, etc.
Sajaki wrote:You can also use the Word censoring acp to replace "user" with "member". This only works for Forum posts.
The point of the thread was to address changing user outside of posts. However I agree a filter works for forum posts.
Respectfully,
Jeremy

DevOPs - Linux Admin, PHP Developer, Oracle DBA OCP Training
Display phpBB statistics on WordPress (Read more...)

Pony99CA
Registered User
Posts: 4783
Joined: Thu Sep 30, 2004 3:13 pm
Location: Hollister, CA
Name: Steve
Contact:

Re: User Vs ...

Post by Pony99CA » Thu Sep 18, 2014 2:27 am

cleverwise wrote:I say again it may be safe in the language files but we aren't talking about a Word document but code. A semicolon in the wrong place can cause a fatal crash much less altering a key variable or function. A global search and replace could easily modify unintended code.
That's a good point. I haven't looked at the language files in a while, but aren't they basically associative arrays with the index for the language string in all upper case? If so, changing "user" to "member" and "User" to "Member" would be fine as long as the search and replace respected case.
cleverwise wrote:
Sajaki wrote:You can also use the Word censoring acp to replace "user" with "member". This only works for Forum posts.
The point of the thread was to address changing user outside of posts. However I agree a filter works for forum posts.
That's more dangerous, though. A phrase like "user interface" would become "member interface" or something like "fuser" (talking about laser printing) would become "fmember").

I personally don't think that it's worth the effort, but it's obviously your board, so if you don't like "user", you're free to change it. (To be fair, when you mentioned the connotations, I first thought of "drug user".)

At least you learned something about the phpBB internals (as did I from your code).

Steve
Silicon Valley Pocket PC (http://www.svpocketpc.com)
Creator of manage_bots and spoof_user (ask me)
Need hosting for a small forum with full cPanel & MySQL access? Contact me or PM me.

RexMundi412
Registered User
Posts: 41
Joined: Fri Nov 15, 2013 1:04 am

Re: User Vs ...

Post by RexMundi412 » Thu Sep 18, 2014 4:18 pm

Great stuff guys!

Wish I wasn't needing to work on other coding for my site, so I could throw in more. Didn't really expect this much on this topic! :D

cleverwise
Registered User
Posts: 37
Joined: Fri Feb 28, 2014 10:55 pm
Location: Atlanta, GA
Name: Jeremy

Re: User Vs ...

Post by cleverwise » Thu Sep 18, 2014 5:25 pm

Pony99CA wrote:That's a good point. I haven't looked at the language files in a while, but aren't they basically associative arrays with the index for the language string in all upper case? If so, changing "user" to "member" and "User" to "Member" would be fine as long as the search and replace respected case.
I don't know as I haven't read every line of code. The language system is a lot more than a single language file. It is pretty split up.
Pony99CA wrote:That's more dangerous, though. A phrase like "user interface" would become "member interface" or something like "fuser" (talking about laser printing) would become "fmember").
Well that would make for some interesting reading. ;) However it won't make phpBB crash or error out.
RexMundi412 wrote:Didn't really expect this much on this topic!
Me either. :)
Respectfully,
Jeremy

DevOPs - Linux Admin, PHP Developer, Oracle DBA OCP Training
Display phpBB statistics on WordPress (Read more...)

Post Reply

Return to “phpBB Discussion”