Index: /extensions/UserAdvManager/branches/2.40/changelog.txt.php
===================================================================
--- /extensions/UserAdvManager/branches/2.40/changelog.txt.php	(revision 14365)
+++ /extensions/UserAdvManager/branches/2.40/changelog.txt.php	(revision 14366)
@@ -297,7 +297,9 @@
 ***** Plugin history (branch 2.40 - Piwigo 2.4 compliant)*****
 **************************************************************
--- 2.40.0 : Bug 2570 fixed - Adding Wiki link to complete plugin documentation
+-- 2.40.0 : Bug 2570 fixed - Adding Wiki link to complete plugin documentation (FR only)
+            Bug 2571 fixed - Piwigo 2.4 compliance : Information email removed on user registration because already managed by Piwigo
             Bug 2591 fixed - Excluding Adult_Content generic users from users tracking list
             Bug 2603 fixed - Php notice when user changes his email in his profile if confirmation by email is set
+            Bug 2619 fixed - Confirmation email when registered user changes his email was not sent and user not demoted
 */
 ?>
Index: /extensions/UserAdvManager/branches/2.40/include/functions.inc.php
===================================================================
--- /extensions/UserAdvManager/branches/2.40/include/functions.inc.php	(revision 14365)
+++ /extensions/UserAdvManager/branches/2.40/include/functions.inc.php	(revision 14366)
@@ -101,27 +101,14 @@
   {
     $passwd = (isset($_POST['password'])) ? $_POST['password'] : '';
-    
-    if ((isset($conf_UAM[0]) and $conf_UAM[0] == 'true') and (isset($conf_UAM[1]) and $conf_UAM[1] == 'local'))
-    {
-      // This is to send an information email and set user to "waiting" group or status until admin validation
-      // -----------------------------------------------------------------------------------------------------
-      SendMail2User(1, $register_user['id'], $register_user['username'], $passwd, $register_user['email'], false);
+
+    if (isset($conf_UAM[1]) and $conf_UAM[1] == 'local')
+    {
+      // This is to set user to "waiting" group or status and without ConfirMail until admin validation
+      // ----------------------------------------------------------------------------------------------
       SetPermission($register_user['id']);// Set to "waiting" group or status until admin validation
-    }
-    elseif ((isset($conf_UAM[0]) and $conf_UAM[0] == 'false') and (isset($conf_UAM[1]) and $conf_UAM[1] == 'local'))
-    {
-      // This is to set user to "waiting" group or status until admin validation
-      // -----------------------------------------------------------------------
-      SetPermission($register_user['id']);// Set to "waiting" group or status until admin validation
-    }
-    elseif ((isset($conf_UAM[0]) and $conf_UAM[0] == 'true') and (isset($conf_UAM[1]) and $conf_UAM[1] == 'false'))
-    {
-      // This is to send an information email without validation key
-      // -----------------------------------------------------------
-      SendMail2User(1, $register_user['id'], $register_user['username'], $passwd, $register_user['email'], false);
     }
     // Sending registration confirmation by email
     // ------------------------------------------
-    elseif ((isset($conf_UAM[0]) and $conf_UAM[0] == 'true' or $conf_UAM[0] == 'false') and (isset($conf_UAM[1]) and $conf_UAM[1] == 'true'))
+    elseif (isset($conf_UAM[1]) and $conf_UAM[1] == 'true')
     {
       if (is_admin() and isset($conf_UAM[19]) and $conf_UAM[19] == 'true')
@@ -298,9 +285,9 @@
     }
 
-    $typemail = 3;
+    $typemail = 3; // Only information email send to user on user profile update if checked
 
     if (!empty($_POST['use_new_pwd']))
     {
-      $typemail = 2;
+      $typemail = 2; // Confirmation email on user profile update - With information email if checked
 
       // Password enforcement control
@@ -322,5 +309,5 @@
     // Sending registration confirmation by email
     // ------------------------------------------
-    if ((isset($conf_UAM[0]) and $conf_UAM[0] == 'true') or (isset($conf_UAM[1]) and $conf_UAM[1] == 'true') or (isset($conf_UAM[1]) and $conf_UAM[1] == 'local'))
+    if (/*(isset($conf_UAM[0]) and $conf_UAM[0] == 'true') or */(isset($conf_UAM[1]) and $conf_UAM[1] == 'true') or (isset($conf_UAM[1]) and $conf_UAM[1] == 'local'))
     {
       $confirm_mail_need = false;
@@ -339,16 +326,19 @@
         // ------------------------------------
         if ($_POST['mail_address'] != $current_email and (isset($conf_UAM[1]) and $conf_UAM[1] == 'true'))
-        
+        {
+          SetPermission($user['id']);// Set to "waiting" group or status until user validation
           $confirm_mail_need = true;
+        }
 
         // This is to set the user to "waiting" group or status until admin validation
         // ---------------------------------------------------------------------------
-        if ($_POST['mail_address'] != $current_email and (isset($conf_UAM[1]) and $conf_UAM[1] == 'local'))
-        
+        elseif ($_POST['mail_address'] != $current_email and (isset($conf_UAM[1]) and $conf_UAM[1] == 'local'))
+        {
           SetPermission($user['id']);// Set to "waiting" group or status until admin validation
           $confirm_mail_need = false;
+        }       
       }
         
-      if ((!empty($_POST['use_new_pwd']) and (isset($conf_UAM[0]) and $conf_UAM[0] == 'true') or $confirm_mail_need))
+      if (((!empty($_POST['use_new_pwd']) and (isset($conf_UAM[0]) and $conf_UAM[0] == 'true')) or $confirm_mail_need))
       {
         $query = '
@@ -925,8 +915,13 @@
   switch($typemail)
   {
-    case 1:
+    case 1: // Confirmation email on user registration - Without information email (already managed by Piwigo)
       $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('UAM_Add of %s', stripslashes($username)));
+
+      break;
+      
+    case 2: // Confirmation email on user profile update - With information email if checked
+      $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('UAM_Update of %s', stripslashes($username)));
       $password = $password <> '' ? $password : l10n('UAM_empty_pwd');
-      
+
       if (isset($conf_UAM[8]) and $conf_UAM[8] <> '')
       {
@@ -946,41 +941,76 @@
         else $infos1_perso = l10n(preg_replace($patterns, $replacements, $conf_UAM[8]))."\n\n"; 
       }
-      
-      break;
-      
-    case 2:
-      $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('UAM_Update of %s', stripslashes($username)));
-      $password = $password <> '' ? $password : l10n('UAM_empty_pwd');
+
+      if (isset($conf_UAM[0]) and $conf_UAM[0] == 'true')
+      {
+        if (isset($conf_UAM[34]) and $conf_UAM[34] == 'true') // Allow display of clear password in email
+        {
+          $infos1 = array(
+            get_l10n_args('UAM_infos_mail %s', stripslashes($username)),
+            get_l10n_args('UAM_User: %s', stripslashes($username)),
+            get_l10n_args('UAM_Password: %s', $password),
+            get_l10n_args('Email: %s', $email),
+            get_l10n_args('', ''),
+          );
+        }
+        else // Do not allow display of clear password in email
+        {
+          $infos1 = array(
+            get_l10n_args('UAM_infos_mail %s', stripslashes($username)),
+            get_l10n_args('UAM_User: %s', stripslashes($username)),
+            get_l10n_args('Email: %s', $email),
+            get_l10n_args('', ''),
+          );
+        }
+      }
 
       break;
         
-    case 3:
+    case 3: // Only information email send to user if checked
       $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('UAM_Update of %s', stripslashes($username)));
       $password = $password <> '' ? $password : l10n('UAM_no_update_pwd');
 
+      if (isset($conf_UAM[8]) and $conf_UAM[8] <> '')
+      {
+        // Management of Extension flags ([username], [mygallery], [myurl])
+        // ----------------------------------------------------------------
+        $patterns[] = '#\[username\]#i';
+        $replacements[] = $username;
+        $patterns[] = '#\[mygallery\]#i';
+        $replacements[] = $conf['gallery_title'];
+        $patterns[] = '#\[myurl\]#i';
+        $replacements[] = $conf['gallery_url'];
+    
+        if (function_exists('get_user_language_desc'))
+        {
+          $infos1_perso = get_user_language_desc(preg_replace($patterns, $replacements, $conf_UAM[8]))."\n\n";
+        }
+        else $infos1_perso = l10n(preg_replace($patterns, $replacements, $conf_UAM[8]))."\n\n"; 
+      }
+
+      if (isset($conf_UAM[0]) and $conf_UAM[0] == 'true')
+      {
+        if (isset($conf_UAM[34]) and $conf_UAM[34] == 'true') // Allow display of clear password in email
+        {
+          $infos1 = array(
+            get_l10n_args('UAM_infos_mail %s', stripslashes($username)),
+            get_l10n_args('UAM_User: %s', stripslashes($username)),
+            get_l10n_args('UAM_Password: %s', $password),
+            get_l10n_args('Email: %s', $email),
+            get_l10n_args('', ''),
+          );
+        }
+        else // Do not allow display of clear password in email
+        {
+          $infos1 = array(
+            get_l10n_args('UAM_infos_mail %s', stripslashes($username)),
+            get_l10n_args('UAM_User: %s', stripslashes($username)),
+            get_l10n_args('Email: %s', $email),
+            get_l10n_args('', ''),
+          );
+        }
+      }
+
       break;
-  }
-
-  if (isset($conf_UAM[0]) and $conf_UAM[0] == 'true')
-  {
-    if (isset($conf_UAM[34]) and $conf_UAM[34] == 'true') // Allow display of clear password in email
-    {
-      $infos1 = array(
-        get_l10n_args('UAM_infos_mail %s', stripslashes($username)),
-        get_l10n_args('UAM_User: %s', stripslashes($username)),
-        get_l10n_args('UAM_Password: %s', $password),
-        get_l10n_args('Email: %s', $email),
-        get_l10n_args('', ''),
-      );
-    }
-    else // Do not allow display of clear password in email
-    {
-      $infos1 = array(
-        get_l10n_args('UAM_infos_mail %s', stripslashes($username)),
-        get_l10n_args('UAM_User: %s', stripslashes($username)),
-        get_l10n_args('Email: %s', $email),
-        get_l10n_args('', ''),
-      );
-    }
   }
 
@@ -1018,29 +1048,4 @@
   }
 
-// ********************************************************
-// **** Pending code since to find how to make it work ****
-// ********************************************************
-// Testing if FCK Editor is used. Then decoding htmlchars to avoid problems with pwg_mail()
-/*$areas = array();
-array_push( $areas,'UAM_MailInfo_Text','UAM_ConfirmMail_Text');
-
-if (function_exists('set_fckeditor_instance'))
-{
-  $fcke_config = unserialize($conf['FCKEditor']);
-  foreach($areas as $area)
-  {
-    if (isset($fcke_config['UAM_MailInfo_Text']) and $fcke_config['UAM_MailInfo_Text'] = true)
-    {
-      $infos1_perso = html_entity_decode($infos1_perso,ENT_QUOTES,UTF-8);
-    }
-    
-    if (isset($fcke_config['UAM_ConfirmMail_Text']) and $fcke_config['UAM_ConfirmMail_Text'] = true)
-    {
-      $infos2_perso = html_entity_decode($infos2_perso,ENT_QUOTES,UTF-8);
-    }
-  }
-}*/
-
-
 // Sending the email with subject and contents
 // -------------------------------------------
@@ -1090,5 +1095,5 @@
   switch($typemail)
   {
-    case 1:
+    case 1: //Generating email content for remind with a new key
       $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('UAM_Reminder_with_key_of_%s', $username));
       
@@ -1134,5 +1139,5 @@
 		break;
       
-    case 2:
+    case 2: //Generating email content for remind without a new key
       $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('UAM_Reminder_without_key_of_%s',$username));
       
Index: /extensions/UserAdvManager/branches/2.40/language/de_DE/help.lang.php
===================================================================
--- /extensions/UserAdvManager/branches/2.40/language/de_DE/help.lang.php	(revision 14365)
+++ /extensions/UserAdvManager/branches/2.40/language/de_DE/help.lang.php	(revision 14366)
@@ -20,5 +20,5 @@
 $lang['UAM_passwadmTitle_d'] = 'Ein Administrator kann einen Benutzer-Account erstellen, mit oder ohne Anwendung der Regel der Komplexit&auml;t des Computings.<br><br>
 Hinweis: Wenn der Benutzer erstellte Konto will Passwort zu &auml;ndern und Passwörter f&uuml;r die Benutzer St&auml;rkung aktiv ist, wird es vorbehaltlich der Regel-Satz.';
-$lang['UAM_infomailTitle_d'] = 'Diese Option erm&ouml;glicht die Automatisierung Senden einer E-Mail-Informationen an einen Benutzer bei der Anmeldung oder bei Änderungen sein Passwort oder E-Mail-Adresse in ihrem Profil.<br><br>
+$lang['UAM_infomailTitle_d'] = 'Diese Option erm&ouml;glicht die Automatisierung Senden einer E-Mail-Informationen an einen Benutzer bei Änderungen sein Passwort oder E-Mail-Adresse in ihrem Profil.<br><br>
 Der Inhalt der Nachricht gesendet wird von einem anpassbaren Teil komponiert, um eine kleine Begrüßung und Einf&uuml;hrung fester Bestandteil in denen die Login, Passwort und E-Mail-Adresse des Benutzers.';
 $lang['UAM_confirmgrpTitle'] = 'Validation Gruppen';
Index: /extensions/UserAdvManager/branches/2.40/language/en_UK/help.lang.php
===================================================================
--- /extensions/UserAdvManager/branches/2.40/language/en_UK/help.lang.php	(revision 14365)
+++ /extensions/UserAdvManager/branches/2.40/language/en_UK/help.lang.php	(revision 14366)
@@ -13,5 +13,5 @@
 $lang['UAM_passwadmTitle_d'] = 'An administrator can create a user account with or without application of the rule of computing complexity.<br><br>
 Note: If the user account created wants to change password and strengthening passwords for users is active, it will be subject to the rule set.';
-$lang['UAM_infomailTitle_d'] = 'This option allows to automate sending an information email to a user when registering or when changes his password or email address in their profile.<br><br>
+$lang['UAM_infomailTitle_d'] = 'This option allows to automate sending an information email to a user when he changes his password or email address in his profile page.<br><br>
 The content of the message sent is composed of a customizable part to introduce a little welcome note and a fixed part indicating the login name, password and email address of the user.';
 $lang['UAM_remailtxt1Title'] = 'Reminder email with new key generated';
Index: /extensions/UserAdvManager/branches/2.40/language/es_ES/help.lang.php
===================================================================
--- /extensions/UserAdvManager/branches/2.40/language/es_ES/help.lang.php	(revision 14365)
+++ /extensions/UserAdvManager/branches/2.40/language/es_ES/help.lang.php	(revision 14366)
@@ -21,5 +21,5 @@
 $lang['UAM_passwadmTitle_d'] = 'Un administrador puede crear una cuenta de usuario, con o sin aplicación de la regla de la complejidad informática.<br><br>
 Nota: Si el  usuario de la cuenta  creada quiere cambiar la contraseña, y el fortalecimiento de las contraseñas de los usuarios está activo, la misma estará sujeta a la norma establecida.';
-$lang['UAM_infomailTitle_d'] = 'Esta opción permite automatizar el envío de un correo electrónico y la información a un usuario cuando se registra o cuando cambie su contraseña o dirección de correo electrónico en su perfil.<br><br>
+$lang['UAM_infomailTitle_d'] = 'Esta opción permite automatizar el envío de un correo electrónico y la información a un usuario cuando cambie su contraseña o dirección de correo electrónico en su perfil.<br><br>
 El contenido del mensaje enviado se compone de una parte personalizable para introducir una nota de bienvenida, y una parte fija que indica el inicio de sesión, contraseña y dirección de correo electrónico del usuario.';
 $lang['UAM_confirmgrpTitle'] = 'Grupos de validación';
Index: /extensions/UserAdvManager/branches/2.40/language/fr_FR/help.lang.php
===================================================================
--- /extensions/UserAdvManager/branches/2.40/language/fr_FR/help.lang.php	(revision 14365)
+++ /extensions/UserAdvManager/branches/2.40/language/fr_FR/help.lang.php	(revision 14366)
@@ -12,5 +12,5 @@
 $lang['UAM_passwadmTitle_d'] = 'Un administrateur peut créer un compte d\'utilisateur avec ou sans application de la règle de calcul de complexité.<br><br>
 A noter : Si l\'utilisateur du compte ainsi créé désire changer de mot de passe et que le renforcement des mots de passe pour les utilisateurs est actif, il sera soumis à la règle configurée.';
-$lang['UAM_infomailTitle_d'] = 'Cette option permet d\'automatiser l\'envoi d\'un email d\'information à un utilisateur lorsqu\'il s\'inscrit ou modifie son mot de passe ou son adresse de messagerie dans son profil.<br><br>
+$lang['UAM_infomailTitle_d'] = 'Cette option permet d\'automatiser l\'envoi d\'un email d\'information à un utilisateur lorsqu\'il modifie son mot de passe ou son adresse de messagerie dans son profil.<br><br>
 Le message envoyé comprend une partie fixe (login, mot de passe et adresse email de l\'utilisateur) et une partie personnalisable par un texte d\'accueil.';
 $lang['UAM_remailtxt1Title'] = 'Message de rappel avec regénération de clé';
Index: /extensions/UserAdvManager/branches/2.40/language/it_IT/help.lang.php
===================================================================
--- /extensions/UserAdvManager/branches/2.40/language/it_IT/help.lang.php	(revision 14365)
+++ /extensions/UserAdvManager/branches/2.40/language/it_IT/help.lang.php	(revision 14366)
@@ -21,5 +21,5 @@
 $lang['UAM_passwadmTitle_d'] = 'Un amministratore può creare un\'pseudo con o senza l\'applicazione della regola della complessità di calcolo.<br><br>
 Nota: Se l\'account utente creato vuole cambiare la password e il rafforzamento password per gli utenti è attivo, sarà soggetta alla regola.';
-$lang['UAM_infomailTitle_d'] = 'Questa opzione consente di automatizzare l\'invio di una e-mail le informazioni a un utente al momento dell\'iscrizione o quando cambia la sua password o indirizzo e-mail nel loro profilo.<br><br>
+$lang['UAM_infomailTitle_d'] = 'Questa opzione consente di automatizzare l\'invio di una e-mail le informazioni a un utente quando cambia la sua password o indirizzo e-mail nel loro profilo.<br><br>
 Il contenuto del messaggio inviato è composto da una parte personalizzabile di introdurre una piccola nota di benvenuto e una parte fissa che indica il login, password e indirizzo di posta elettronica dell\'utente.';
 
Index: /extensions/UserAdvManager/branches/2.40/language/lv_LV/help.lang.php
===================================================================
--- /extensions/UserAdvManager/branches/2.40/language/lv_LV/help.lang.php	(revision 14365)
+++ /extensions/UserAdvManager/branches/2.40/language/lv_LV/help.lang.php	(revision 14366)
@@ -22,6 +22,4 @@
 $lang['UAM_passwadmTitle_d'] = 'Administrators var izveidot lietotāja kontu ar vai bez paroles komplicētības pārbaudes aplikāciju.<br><br>
 Note: Ja lietotājs, kura konts jau izveidots, grib nomainīt savu paroli un ir aktīva paroles stingrības uzlabišanas aplikācija, būs jāievēro visi stingrības uzlabošanas noteikumi.';
-$lang['UAM_infomailTitle_d'] = 'Šī opcija ļauj automātiski ar e-pastu nosūtīt lietotājam informatīvu ziņu par reģistrāciju vai profila paroles vai e-pasta adreses maiņu.<br><br>
-Nosūtāmā ziņa kompozicionāli sastāv no pielāgojamās daļas, maza ievada un fiksētās daļas, kas ietver info par lietotāja loginu, paroli un e-pasta adresi.';
 $lang['UAM_confirmgrpTitle'] = 'Pārbaudāmās Grupas';
 $lang['UAM_confirmgrpTitle_d'] = '<b style=&quot;color:
Index: /extensions/UserAdvManager/trunk/changelog.txt.php
===================================================================
--- /extensions/UserAdvManager/trunk/changelog.txt.php	(revision 14365)
+++ /extensions/UserAdvManager/trunk/changelog.txt.php	(revision 14366)
@@ -297,7 +297,9 @@
 ***** Plugin history (branch 2.40 - Piwigo 2.4 compliant)*****
 **************************************************************
--- 2.40.0 : Bug 2570 fixed - Adding Wiki link to complete plugin documentation
+-- 2.40.0 : Bug 2570 fixed - Adding Wiki link to complete plugin documentation (FR only)
+            Bug 2571 fixed - Piwigo 2.4 compliance : Information email removed on user registration because already managed by Piwigo
             Bug 2591 fixed - Excluding Adult_Content generic users from users tracking list
             Bug 2603 fixed - Php notice when user changes his email in his profile if confirmation by email is set
+            Bug 2619 fixed - Confirmation email when registered user changes his email was not sent and user not demoted
 */
 ?>
Index: /extensions/UserAdvManager/trunk/include/functions.inc.php
===================================================================
--- /extensions/UserAdvManager/trunk/include/functions.inc.php	(revision 14365)
+++ /extensions/UserAdvManager/trunk/include/functions.inc.php	(revision 14366)
@@ -101,27 +101,14 @@
   {
     $passwd = (isset($_POST['password'])) ? $_POST['password'] : '';
-    
-    if ((isset($conf_UAM[0]) and $conf_UAM[0] == 'true') and (isset($conf_UAM[1]) and $conf_UAM[1] == 'local'))
-    {
-      // This is to send an information email and set user to "waiting" group or status until admin validation
-      // -----------------------------------------------------------------------------------------------------
-      SendMail2User(1, $register_user['id'], $register_user['username'], $passwd, $register_user['email'], false);
+
+    if (isset($conf_UAM[1]) and $conf_UAM[1] == 'local')
+    {
+      // This is to set user to "waiting" group or status and without ConfirMail until admin validation
+      // ----------------------------------------------------------------------------------------------
       SetPermission($register_user['id']);// Set to "waiting" group or status until admin validation
-    }
-    elseif ((isset($conf_UAM[0]) and $conf_UAM[0] == 'false') and (isset($conf_UAM[1]) and $conf_UAM[1] == 'local'))
-    {
-      // This is to set user to "waiting" group or status until admin validation
-      // -----------------------------------------------------------------------
-      SetPermission($register_user['id']);// Set to "waiting" group or status until admin validation
-    }
-    elseif ((isset($conf_UAM[0]) and $conf_UAM[0] == 'true') and (isset($conf_UAM[1]) and $conf_UAM[1] == 'false'))
-    {
-      // This is to send an information email without validation key
-      // -----------------------------------------------------------
-      SendMail2User(1, $register_user['id'], $register_user['username'], $passwd, $register_user['email'], false);
     }
     // Sending registration confirmation by email
     // ------------------------------------------
-    elseif ((isset($conf_UAM[0]) and $conf_UAM[0] == 'true' or $conf_UAM[0] == 'false') and (isset($conf_UAM[1]) and $conf_UAM[1] == 'true'))
+    elseif (isset($conf_UAM[1]) and $conf_UAM[1] == 'true')
     {
       if (is_admin() and isset($conf_UAM[19]) and $conf_UAM[19] == 'true')
@@ -298,9 +285,9 @@
     }
 
-    $typemail = 3;
+    $typemail = 3; // Only information email send to user on user profile update if checked
 
     if (!empty($_POST['use_new_pwd']))
     {
-      $typemail = 2;
+      $typemail = 2; // Confirmation email on user profile update - With information email if checked
 
       // Password enforcement control
@@ -322,5 +309,5 @@
     // Sending registration confirmation by email
     // ------------------------------------------
-    if ((isset($conf_UAM[0]) and $conf_UAM[0] == 'true') or (isset($conf_UAM[1]) and $conf_UAM[1] == 'true') or (isset($conf_UAM[1]) and $conf_UAM[1] == 'local'))
+    if (/*(isset($conf_UAM[0]) and $conf_UAM[0] == 'true') or */(isset($conf_UAM[1]) and $conf_UAM[1] == 'true') or (isset($conf_UAM[1]) and $conf_UAM[1] == 'local'))
     {
       $confirm_mail_need = false;
@@ -339,16 +326,19 @@
         // ------------------------------------
         if ($_POST['mail_address'] != $current_email and (isset($conf_UAM[1]) and $conf_UAM[1] == 'true'))
-        
+        {
+          SetPermission($user['id']);// Set to "waiting" group or status until user validation
           $confirm_mail_need = true;
+        }
 
         // This is to set the user to "waiting" group or status until admin validation
         // ---------------------------------------------------------------------------
-        if ($_POST['mail_address'] != $current_email and (isset($conf_UAM[1]) and $conf_UAM[1] == 'local'))
-        
+        elseif ($_POST['mail_address'] != $current_email and (isset($conf_UAM[1]) and $conf_UAM[1] == 'local'))
+        {
           SetPermission($user['id']);// Set to "waiting" group or status until admin validation
           $confirm_mail_need = false;
+        }       
       }
         
-      if ((!empty($_POST['use_new_pwd']) and (isset($conf_UAM[0]) and $conf_UAM[0] == 'true') or $confirm_mail_need))
+      if (((!empty($_POST['use_new_pwd']) and (isset($conf_UAM[0]) and $conf_UAM[0] == 'true')) or $confirm_mail_need))
       {
         $query = '
@@ -925,8 +915,13 @@
   switch($typemail)
   {
-    case 1:
+    case 1: // Confirmation email on user registration - Without information email (already managed by Piwigo)
       $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('UAM_Add of %s', stripslashes($username)));
+
+      break;
+      
+    case 2: // Confirmation email on user profile update - With information email if checked
+      $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('UAM_Update of %s', stripslashes($username)));
       $password = $password <> '' ? $password : l10n('UAM_empty_pwd');
-      
+
       if (isset($conf_UAM[8]) and $conf_UAM[8] <> '')
       {
@@ -946,41 +941,76 @@
         else $infos1_perso = l10n(preg_replace($patterns, $replacements, $conf_UAM[8]))."\n\n"; 
       }
-      
-      break;
-      
-    case 2:
-      $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('UAM_Update of %s', stripslashes($username)));
-      $password = $password <> '' ? $password : l10n('UAM_empty_pwd');
+
+      if (isset($conf_UAM[0]) and $conf_UAM[0] == 'true')
+      {
+        if (isset($conf_UAM[34]) and $conf_UAM[34] == 'true') // Allow display of clear password in email
+        {
+          $infos1 = array(
+            get_l10n_args('UAM_infos_mail %s', stripslashes($username)),
+            get_l10n_args('UAM_User: %s', stripslashes($username)),
+            get_l10n_args('UAM_Password: %s', $password),
+            get_l10n_args('Email: %s', $email),
+            get_l10n_args('', ''),
+          );
+        }
+        else // Do not allow display of clear password in email
+        {
+          $infos1 = array(
+            get_l10n_args('UAM_infos_mail %s', stripslashes($username)),
+            get_l10n_args('UAM_User: %s', stripslashes($username)),
+            get_l10n_args('Email: %s', $email),
+            get_l10n_args('', ''),
+          );
+        }
+      }
 
       break;
         
-    case 3:
+    case 3: // Only information email send to user if checked
       $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('UAM_Update of %s', stripslashes($username)));
       $password = $password <> '' ? $password : l10n('UAM_no_update_pwd');
 
+      if (isset($conf_UAM[8]) and $conf_UAM[8] <> '')
+      {
+        // Management of Extension flags ([username], [mygallery], [myurl])
+        // ----------------------------------------------------------------
+        $patterns[] = '#\[username\]#i';
+        $replacements[] = $username;
+        $patterns[] = '#\[mygallery\]#i';
+        $replacements[] = $conf['gallery_title'];
+        $patterns[] = '#\[myurl\]#i';
+        $replacements[] = $conf['gallery_url'];
+    
+        if (function_exists('get_user_language_desc'))
+        {
+          $infos1_perso = get_user_language_desc(preg_replace($patterns, $replacements, $conf_UAM[8]))."\n\n";
+        }
+        else $infos1_perso = l10n(preg_replace($patterns, $replacements, $conf_UAM[8]))."\n\n"; 
+      }
+
+      if (isset($conf_UAM[0]) and $conf_UAM[0] == 'true')
+      {
+        if (isset($conf_UAM[34]) and $conf_UAM[34] == 'true') // Allow display of clear password in email
+        {
+          $infos1 = array(
+            get_l10n_args('UAM_infos_mail %s', stripslashes($username)),
+            get_l10n_args('UAM_User: %s', stripslashes($username)),
+            get_l10n_args('UAM_Password: %s', $password),
+            get_l10n_args('Email: %s', $email),
+            get_l10n_args('', ''),
+          );
+        }
+        else // Do not allow display of clear password in email
+        {
+          $infos1 = array(
+            get_l10n_args('UAM_infos_mail %s', stripslashes($username)),
+            get_l10n_args('UAM_User: %s', stripslashes($username)),
+            get_l10n_args('Email: %s', $email),
+            get_l10n_args('', ''),
+          );
+        }
+      }
+
       break;
-  }
-
-  if (isset($conf_UAM[0]) and $conf_UAM[0] == 'true')
-  {
-    if (isset($conf_UAM[34]) and $conf_UAM[34] == 'true') // Allow display of clear password in email
-    {
-      $infos1 = array(
-        get_l10n_args('UAM_infos_mail %s', stripslashes($username)),
-        get_l10n_args('UAM_User: %s', stripslashes($username)),
-        get_l10n_args('UAM_Password: %s', $password),
-        get_l10n_args('Email: %s', $email),
-        get_l10n_args('', ''),
-      );
-    }
-    else // Do not allow display of clear password in email
-    {
-      $infos1 = array(
-        get_l10n_args('UAM_infos_mail %s', stripslashes($username)),
-        get_l10n_args('UAM_User: %s', stripslashes($username)),
-        get_l10n_args('Email: %s', $email),
-        get_l10n_args('', ''),
-      );
-    }
   }
 
@@ -1018,29 +1048,4 @@
   }
 
-// ********************************************************
-// **** Pending code since to find how to make it work ****
-// ********************************************************
-// Testing if FCK Editor is used. Then decoding htmlchars to avoid problems with pwg_mail()
-/*$areas = array();
-array_push( $areas,'UAM_MailInfo_Text','UAM_ConfirmMail_Text');
-
-if (function_exists('set_fckeditor_instance'))
-{
-  $fcke_config = unserialize($conf['FCKEditor']);
-  foreach($areas as $area)
-  {
-    if (isset($fcke_config['UAM_MailInfo_Text']) and $fcke_config['UAM_MailInfo_Text'] = true)
-    {
-      $infos1_perso = html_entity_decode($infos1_perso,ENT_QUOTES,UTF-8);
-    }
-    
-    if (isset($fcke_config['UAM_ConfirmMail_Text']) and $fcke_config['UAM_ConfirmMail_Text'] = true)
-    {
-      $infos2_perso = html_entity_decode($infos2_perso,ENT_QUOTES,UTF-8);
-    }
-  }
-}*/
-
-
 // Sending the email with subject and contents
 // -------------------------------------------
@@ -1090,5 +1095,5 @@
   switch($typemail)
   {
-    case 1:
+    case 1: //Generating email content for remind with a new key
       $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('UAM_Reminder_with_key_of_%s', $username));
       
@@ -1134,5 +1139,5 @@
 		break;
       
-    case 2:
+    case 2: //Generating email content for remind without a new key
       $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('UAM_Reminder_without_key_of_%s',$username));
       
Index: /extensions/UserAdvManager/trunk/language/de_DE/help.lang.php
===================================================================
--- /extensions/UserAdvManager/trunk/language/de_DE/help.lang.php	(revision 14365)
+++ /extensions/UserAdvManager/trunk/language/de_DE/help.lang.php	(revision 14366)
@@ -20,5 +20,5 @@
 $lang['UAM_passwadmTitle_d'] = 'Ein Administrator kann einen Benutzer-Account erstellen, mit oder ohne Anwendung der Regel der Komplexit&auml;t des Computings.<br><br>
 Hinweis: Wenn der Benutzer erstellte Konto will Passwort zu &auml;ndern und Passwörter f&uuml;r die Benutzer St&auml;rkung aktiv ist, wird es vorbehaltlich der Regel-Satz.';
-$lang['UAM_infomailTitle_d'] = 'Diese Option erm&ouml;glicht die Automatisierung Senden einer E-Mail-Informationen an einen Benutzer bei der Anmeldung oder bei Änderungen sein Passwort oder E-Mail-Adresse in ihrem Profil.<br><br>
+$lang['UAM_infomailTitle_d'] = 'Diese Option erm&ouml;glicht die Automatisierung Senden einer E-Mail-Informationen an einen Benutzer bei Änderungen sein Passwort oder E-Mail-Adresse in ihrem Profil.<br><br>
 Der Inhalt der Nachricht gesendet wird von einem anpassbaren Teil komponiert, um eine kleine Begrüßung und Einf&uuml;hrung fester Bestandteil in denen die Login, Passwort und E-Mail-Adresse des Benutzers.';
 $lang['UAM_confirmgrpTitle'] = 'Validation Gruppen';
Index: /extensions/UserAdvManager/trunk/language/en_UK/help.lang.php
===================================================================
--- /extensions/UserAdvManager/trunk/language/en_UK/help.lang.php	(revision 14365)
+++ /extensions/UserAdvManager/trunk/language/en_UK/help.lang.php	(revision 14366)
@@ -13,5 +13,5 @@
 $lang['UAM_passwadmTitle_d'] = 'An administrator can create a user account with or without application of the rule of computing complexity.<br><br>
 Note: If the user account created wants to change password and strengthening passwords for users is active, it will be subject to the rule set.';
-$lang['UAM_infomailTitle_d'] = 'This option allows to automate sending an information email to a user when registering or when changes his password or email address in their profile.<br><br>
+$lang['UAM_infomailTitle_d'] = 'This option allows to automate sending an information email to a user when he changes his password or email address in his profile page.<br><br>
 The content of the message sent is composed of a customizable part to introduce a little welcome note and a fixed part indicating the login name, password and email address of the user.';
 $lang['UAM_remailtxt1Title'] = 'Reminder email with new key generated';
Index: /extensions/UserAdvManager/trunk/language/es_ES/help.lang.php
===================================================================
--- /extensions/UserAdvManager/trunk/language/es_ES/help.lang.php	(revision 14365)
+++ /extensions/UserAdvManager/trunk/language/es_ES/help.lang.php	(revision 14366)
@@ -21,5 +21,5 @@
 $lang['UAM_passwadmTitle_d'] = 'Un administrador puede crear una cuenta de usuario, con o sin aplicación de la regla de la complejidad informática.<br><br>
 Nota: Si el  usuario de la cuenta  creada quiere cambiar la contraseña, y el fortalecimiento de las contraseñas de los usuarios está activo, la misma estará sujeta a la norma establecida.';
-$lang['UAM_infomailTitle_d'] = 'Esta opción permite automatizar el envío de un correo electrónico y la información a un usuario cuando se registra o cuando cambie su contraseña o dirección de correo electrónico en su perfil.<br><br>
+$lang['UAM_infomailTitle_d'] = 'Esta opción permite automatizar el envío de un correo electrónico y la información a un usuario cuando cambie su contraseña o dirección de correo electrónico en su perfil.<br><br>
 El contenido del mensaje enviado se compone de una parte personalizable para introducir una nota de bienvenida, y una parte fija que indica el inicio de sesión, contraseña y dirección de correo electrónico del usuario.';
 $lang['UAM_confirmgrpTitle'] = 'Grupos de validación';
Index: /extensions/UserAdvManager/trunk/language/fr_FR/help.lang.php
===================================================================
--- /extensions/UserAdvManager/trunk/language/fr_FR/help.lang.php	(revision 14365)
+++ /extensions/UserAdvManager/trunk/language/fr_FR/help.lang.php	(revision 14366)
@@ -12,5 +12,5 @@
 $lang['UAM_passwadmTitle_d'] = 'Un administrateur peut créer un compte d\'utilisateur avec ou sans application de la règle de calcul de complexité.<br><br>
 A noter : Si l\'utilisateur du compte ainsi créé désire changer de mot de passe et que le renforcement des mots de passe pour les utilisateurs est actif, il sera soumis à la règle configurée.';
-$lang['UAM_infomailTitle_d'] = 'Cette option permet d\'automatiser l\'envoi d\'un email d\'information à un utilisateur lorsqu\'il s\'inscrit ou modifie son mot de passe ou son adresse de messagerie dans son profil.<br><br>
+$lang['UAM_infomailTitle_d'] = 'Cette option permet d\'automatiser l\'envoi d\'un email d\'information à un utilisateur lorsqu\'il modifie son mot de passe ou son adresse de messagerie dans son profil.<br><br>
 Le message envoyé comprend une partie fixe (login, mot de passe et adresse email de l\'utilisateur) et une partie personnalisable par un texte d\'accueil.';
 $lang['UAM_remailtxt1Title'] = 'Message de rappel avec regénération de clé';
Index: /extensions/UserAdvManager/trunk/language/it_IT/help.lang.php
===================================================================
--- /extensions/UserAdvManager/trunk/language/it_IT/help.lang.php	(revision 14365)
+++ /extensions/UserAdvManager/trunk/language/it_IT/help.lang.php	(revision 14366)
@@ -21,5 +21,5 @@
 $lang['UAM_passwadmTitle_d'] = 'Un amministratore può creare un\'pseudo con o senza l\'applicazione della regola della complessità di calcolo.<br><br>
 Nota: Se l\'account utente creato vuole cambiare la password e il rafforzamento password per gli utenti è attivo, sarà soggetta alla regola.';
-$lang['UAM_infomailTitle_d'] = 'Questa opzione consente di automatizzare l\'invio di una e-mail le informazioni a un utente al momento dell\'iscrizione o quando cambia la sua password o indirizzo e-mail nel loro profilo.<br><br>
+$lang['UAM_infomailTitle_d'] = 'Questa opzione consente di automatizzare l\'invio di una e-mail le informazioni a un utente quando cambia la sua password o indirizzo e-mail nel loro profilo.<br><br>
 Il contenuto del messaggio inviato è composto da una parte personalizzabile di introdurre una piccola nota di benvenuto e una parte fissa che indica il login, password e indirizzo di posta elettronica dell\'utente.';
 
Index: /extensions/UserAdvManager/trunk/language/lv_LV/help.lang.php
===================================================================
--- /extensions/UserAdvManager/trunk/language/lv_LV/help.lang.php	(revision 14365)
+++ /extensions/UserAdvManager/trunk/language/lv_LV/help.lang.php	(revision 14366)
@@ -22,6 +22,4 @@
 $lang['UAM_passwadmTitle_d'] = 'Administrators var izveidot lietotāja kontu ar vai bez paroles komplicētības pārbaudes aplikāciju.<br><br>
 Note: Ja lietotājs, kura konts jau izveidots, grib nomainīt savu paroli un ir aktīva paroles stingrības uzlabišanas aplikācija, būs jāievēro visi stingrības uzlabošanas noteikumi.';
-$lang['UAM_infomailTitle_d'] = 'Šī opcija ļauj automātiski ar e-pastu nosūtīt lietotājam informatīvu ziņu par reģistrāciju vai profila paroles vai e-pasta adreses maiņu.<br><br>
-Nosūtāmā ziņa kompozicionāli sastāv no pielāgojamās daļas, maza ievada un fiksētās daļas, kas ietver info par lietotāja loginu, paroli un e-pasta adresi.';
 $lang['UAM_confirmgrpTitle'] = 'Pārbaudāmās Grupas';
 $lang['UAM_confirmgrpTitle_d'] = '<b style=&quot;color:
