MyBB Hacks

Full Version: Display Name / User Nickname Plugin
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6
This plugin allows users to have differing display and login names.  The former is displayed publicly to everyone (what is seen in posts), whereas the latter is only used for login purposes.

This plugin primarily patches MyBB's login, registration and lost password routines, so "username" often refers to the user's display name (perhaps this should be clarified a bit...).
Thus, to allow users to change their display name, simply give them their usergroup the ability to change username.

Known limitations/issues:
  • Only tested on (and intentionally designed for) MySQL - dunno if it works on other DB engines
  • During un/installation, the plugin will close the board whilst it performs processing to prevent potential issues with database integrity
  • It relies on a few things in the supplied English messages.lang.php and may not work correctly with other languages - this only really affects activation emails
  • Various English phrases are hard coded in
  • Login names aren't quite as vigorously checked as MyBB checks user names - this is to somewhat give users more flexibility, but a potential issue is that when this plugin is deactivated, everyone's username will be set to the login name.  This will generally be a minor issue however.
  • Like login names, display names must be unique (no two people can have the same display name at the same time)
  • Quotes in posts may become a little confusing/misleading if people change their display name often - you may wish to consider my vB Quote plugin which can get around this issue
  • Often "Username" is referred to, although whether it refers to a login name or a display name may be unclear.  For example, when a user tries to log in, it asks for their username and password.  Perhaps I might change this to "login name and password" in a later version.
  • I haven't done a lot of testing on this, so you probably should do some before you use it (and do so at your own risk)

- compatibility fixes for MyBB 1.8
- template modifications are now performed on activate/deactivate instead of install/uninstall.  Please note that deactivating the plugin may cause things to go into a weird state, so please don't leave it in that state for long (it's only intended to allow you to fix templates)
- Please see this note if you are upgrading from MyBB 1.6 to 1.8

- fix compatibility issues with MyBB 1.6 ACP logins

- fixed bug: couldn't update login name

- updated control_object function again (no functional difference, but may be required to keep compatibility with my other plugins)
- fixed a potential issue during uninstallation if there's a conflict between login and display names of different users

- updated control_object function with more accurate version; functionally indifferent, but may be required to be compatible with my other plugins

- fixed bug in regards to activation emails

- initial release
If we want to display the login name in postbit/postbit_classic template (only admin can see it):

<if $post['loginname'] and $mybb->usergroup['cancp'] == 1 then>
<func htmlspecialchars_uni>{$post['loginname']}</func>

Is it right, Yumi? (I'm using PHP In Templates / Complex Templates plugin).

^ Yes, that _should_ be right (haven't tested it).  Unsure if loginname is pulled by MyBB's query by default, but from memory, it is.

Updated to v1.03:
- updated control_object function again (no functional difference, but may be required to keep compatibility with my other plugins)
- fixed a potential issue during uninstallation if there's a conflict between login and display names of different users
Thanks, for the update, Yumi.
Very good Plug-in
thanks for this plugin.
But i have one problem, when i try to edit user's <loginname>, it not change.
What is the reason?
Sorry about that.  Can you see if the v1.04 update fixes this?  Thanks.
Now I have problems with the register window.

The field to put the display name don't appear
Please make sure you have this line in your member_register template, just before the {$passboxes} variable:

<td><input type="text" class="textbox" name="loginname" id="loginname" style="width: 100%" value="{$loginname}" /></td><td><input type="text" class="textbox" name="username" id="username" style="width: 100%" value="{$username}" /></td>

in the name of god

hi my firend

Can we asign other language to this plugin?

creat dispname.lang.php file and include this variable:

PHP Code:
$l['loginname'] = 'Login Name';
$l['username'] = 'Display Username';
$l['js_validator_checking_loginname'] = 'Checking if login name is available';

than opload it to inc/languages/english and translate file to inc/languages/other lng

Now, edit dispname.php and find:

PHP Code:
function dispname_register_langs() {
	global $lang;
	$lang->loginname = 'Login Name';
	$lang->username = 'Display Username';
	//$lang->js_validator_checking_username = 'Checking if display name is available';
	$lang->js_validator_checking_loginname = 'Checking if login name is available';
	$GLOBALS['loginname'] = htmlspecialchars_uni($GLOBALS['mybb']->input['loginname']);

and Replace it whit :

PHP Code:
function dispname_register_langs() {
    global $lang;
    $GLOBALS['loginname'] = htmlspecialchars_uni($GLOBALS['mybb']->input['loginname']);

Is it right?

If No please help me.

I have another problem too.
when Deactivate and so activate again plugin, all displayname reset to loginname.!

Can it be adjusted so that hold the changesŲŸ


Pages: 1 2 3 4 5 6
Reference URL's