Changeset 19431


Ignore:
Timestamp:
Dec 15, 2012, 12:16:18 AM (8 years ago)
Author:
plg
Message:

ability to force a username

Location:
extensions/user_mass_register
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/user_mass_register/admin.php

    r18826 r19431  
    7373if (isset($_POST['submit']))
    7474{
    75   $emails = explode("\n", $_POST['emails']);
     75  $lines = explode("\n", $_POST['users']);
    7676
    7777  $emails_to_create = array();
     
    8080  $emails_created = array();
    8181  $emails_on_error = array();
    82  
    83   foreach ($emails as $email)
    84   {
     82  $username_for = array();
     83 
     84  foreach ($lines as $line)
     85  {
     86    $fields = explode(';', $line);
     87    $email = trim($fields[0]);
     88
     89    if (isset($fields[1]))
     90    {
     91      $username_for[$email] = trim($fields[1]);
     92    }
     93
    8594    $email = trim($email);
    8695
     
    108117  {   
    109118    // find a username
    110     list($base_username,) = explode('@', $email);
     119    if (isset($username_for[$email]))
     120    {
     121      $username = $username_for[$email];
     122    }
     123    else
     124    {
     125      list($username,) = explode('@', $email);
     126    }
    111127   
    112     $username = $base_username;
     128    $base_username = $username;
    113129    $i = 2;
    114130    while (get_userid($username))
  • extensions/user_mass_register/admin.tpl

    r18826 r19431  
     1{literal}
     2<style>
     3fieldset p {text-align:left;margin:0;}
     4</style>
     5{/literal}
     6
    17<div class="titrePage">
    28        <h2>User Mass Register</h2>
    39</div>
    410
    5 <form method="post" action="" class="properties">
    6   <p style="text-align:left;">
     11<fieldset>
     12  <legend>{'Example'|@translate}</legend>
     13  <p style="">
     14    john.connor@gmail.com<br>
     15    sarah.connor@hotmail.com; Sarah<br>
     16    paul@anderson.com
     17  </p>
     18</fieldset>
     19
     20<fieldset>
     21  <legend>{'Register users'|@translate}</legend>
     22<form method="post" action="">
     23  <p>
     24{*
    725    <strong>{'Email addresses'|@translate}</strong> {'(one on each line)'|@translate}<br>
    8     <textarea name="emails" style="width:500px;height:300px;">{$EMAILS}</textarea>
     26*}
     27    <textarea name="users" style="width:500px;height:300px;">{$EMAILS}</textarea>
    928  </p>
    1029
    11   <p style="text-align:left;"><input type="submit" name="submit" value="{'Register users'|@translate}"></p>
     30  <p style="margin-top:10px"><input type="submit" name="submit" value="{'Submit'|@translate}"></p>
    1231
    1332</form>
     33
     34</fieldset>
  • extensions/user_mass_register/language/en_UK/plugin.lang.php

    r18826 r19431  
    88$lang['%d email addresses rejected: %s'] = '%d email addresses rejected: %s';
    99$lang['%d email addresses already exist: %s'] = '%d email addresses already exist: %s';
     10$lang['Example'] = 'Example';
    1011?>
  • extensions/user_mass_register/language/fr_FR/plugin.lang.php

    r18826 r19431  
    88$lang['%d email addresses rejected: %s'] = '%d adresses email rejetées : %s';
    99$lang['%d email addresses already exist: %s'] = '%d adresse email existent déjà : %s';
     10$lang['Example'] = 'Exemple';
    1011?>
Note: See TracChangeset for help on using the changeset viewer.