Warning: The author of this contribution does not provide support for it anymore.

ACP Add User MOD

How to make it compatible with "Separate Login & User Name" - ACP Add User MOD

How to make it compatible with "Separate Login & User Name"

by batambale » Sun Jun 19, 2011 2:00 am

Hi,

I have installed this MOD and I like it very much. It is exactly what I need in my forum, thanks so much once again.

Now I have found another MOD named, Separate Login and User Name, which is on this link: http://www.phpbb.com/customise/db/mod/separate_login_and_user_name/. I think that MOD will be very useful to me as well. It allows the creation of another field to be used as login name, so that the standard username can be used as "Display Name" and users can change it as they wish. This is another feature I really need but unfortunately not supported by phpBB.

My question is, what modifications do I need to make so that:
  1. the new loginname field that will be introduced by that MOD is included in the the "Add User" form.
  2. the email message that is sent to the user will now contain the loginname instead of the username.
Are there any other issues I need to worry about for this MOD to work correctly if I install the other MOD?

Thanks for your help as usual.
batambale
Registered User
Posts: 39
Joined: Tue Jun 07, 2011 9:45 am

Re: How to make it compatible with "Separate Login & User Name"

by RMcGirr83 » Mon Jun 20, 2011 3:55 pm

There will probably be an issue with using this mod with that one as that one adds a new column to the users table that is used for people to login with.
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then you can support me by buying a beer šŸŗ
User avatar
RMcGirr83
Former Team Member
Posts: 22105
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: How to make it compatible with "Separate Login & User Name"

by batambale » Mon Jun 20, 2011 10:44 pm

RMcGirr83 wrote:There will probably be an issue with using this mod with that one as that one adds a new column to the users table that is used for people to login with.


Yes, this is what understand too. But I thought it should not be too difficult to make the two mods co-exist. So you think it involves more than just the two issues I enumerated above right? I really need both mods. If there is a way you can help it will be much appreciated. Thanks.
batambale
Registered User
Posts: 39
Joined: Tue Jun 07, 2011 9:45 am

Re: How to make it compatible with "Separate Login & User Name"

by batambale » Tue Jun 21, 2011 9:50 am

OK Good news. I managed to do the changes myself and I now have both mods working perfectly.
I will try to explain the changes later. Can someone direct me on how to present code in a nice format as is done in this forum. I mean the sequence; Find, Add Before/After, Replace, etc.

Thanks.
batambale
Registered User
Posts: 39
Joined: Tue Jun 07, 2011 9:45 am

Re: How to make it compatible with "Separate Login & User Name"

by batambale » Wed Jun 22, 2011 5:30 am

Here are the changes I made to this mod, ā€œACP Add Userā€, so that it works together with the ā€œSeparate Login and User Nameā€ mod. All changes were made manually to four files that came with the ā€œACP Add Userā€ mod. If you are not comfortable making manual changes to your system, I suggest you do not attempt this. In any case, I suggest you make backup copies of the affected files should you run into trouble. As a disclaimer, if you decide to follow these steps, you are doing so at your own risk and I bear no responsibility whatsoever.

Step 1: Here I am assuming you already have ā€œACP Add Userā€ installed. So the first step is to download and Install ā€œSeparate Login and User Nameā€ mod. I suggest you should do this using AutoMOD. The ā€œSeparate Login and User Nameā€ should work fine as expected but of course it will break the ā€œACP Add Userā€ mod. So you need to follow the changes suggested in the next sequence of steps to restore it back to its normal function under the changes introduced by ā€œSeparate Login and User Nameā€.

Step2: Open the file: adm/style/acp_add_user.html , and edit it as follows:

Find:

Code: Select all

<p>{L_REG_COND}</p>

Add After:

Code: Select all

   <dl>
      <dt><label for="loginname">{L_LOGINNAME}:</label>
         <br /><span>{L_LOGINNAME_EXPLAIN}</span></dt>
      <dd><input class="medium" type="text" id="loginname" name="loginname" size="25" maxlength="40" value="{NEW_LOGINNAME}" /></dd>
   </dl>


Step3: Open the file, includes/acp/acp_add_user.php, and edit it as follows:

(a) Find:

Code: Select all

$data = array(

Add After:

Code: Select all

         'loginname'      => utf8_normalize_nfc(request_var('loginname', '', true)), 

(b) Find:

Code: Select all

$validate_array = array(

Add After:

Code: Select all

            'loginname'         => array(
               array('string', false, $config['min_name_chars'], $config['max_name_chars']),
               array('loginname')),

(c) Find:

Code: Select all

$user_row = array(

Add After:

Code: Select all

               'loginname'            => $data['loginname'], 

(d) Find:

Code: Select all

$messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);

Add After:

Code: Select all

               $messenger->headers('X-AntiAbuse: Loginname - ' . $user->data['loginname']); 

(e) Find:

Code: Select all

'WELCOME_MSG'   => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])),


Add After:

Code: Select all

                  'LOGINNAME'      => htmlspecialchars_decode($data['loginname']),

(f) Find:

Code: Select all

                  $sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type 
                     FROM ' . USERS_TABLE . ' ' .
                     $where_sql;

Replace with:

Code: Select all

                  $sql = 'SELECT user_id, loginname, username, user_email, user_lang, user_jabber, user_notify_type 
                     FROM ' . USERS_TABLE . ' ' .
                     $where_sql;

(g) Find:

Code: Select all

'U_USER_DETAILS'   => "$server_url/memberlist.$phpEx?mode=viewprofile&amp;u=$user_id",

Add Before:

Code: Select all

                        'LOGINNAME'         => htmlspecialchars_decode($data['loginname']),

(h) Find:

Code: Select all

'ERROR'            => (sizeof($error)) ? implode('<br />', $error) : ''

Add After:

Code: Select all

         'NEW_LOGINNAME'      => $data['loginname'], 
         'L_LOGINNAME_EXPLAIN'=> sprintf($user->lang[$config['allow_name_chars'] . '_EXPLAIN'], $config['min_name_chars'], $config['max_name_chars']),


Step4: Open the file: language/en/email/user_added_inactive.txt, and edit it as follows:

Find:

Code: Select all

Username: {USERNAME}


Replace with

Code: Select all

Login name: {LOGINNAME}


Step 5: Repeat step 4 with this file: language/en/email/user_added_welcome.txt

Step 6: Upload the updated files, refresh the template on your style (I am using prosilver) and purge the catch.

These are all the steps I followed and it worked for me. I hope someone finds these useful.
batambale
Registered User
Posts: 39
Joined: Tue Jun 07, 2011 9:45 am

Re: How to make it compatible with "Separate Login & User Na

by Chadillac » Fri Jan 31, 2014 4:25 pm

This works great, thanks for posting it!
Chadillac
Registered User
Posts: 1
Joined: Fri Jan 31, 2014 4:23 pm