Index: /extensions/NBC_UserAdvManager/trunk/changelog.txt.php
===================================================================
--- /extensions/NBC_UserAdvManager/trunk/changelog.txt.php	(revision 6756)
+++ /extensions/NBC_UserAdvManager/trunk/changelog.txt.php	(revision 6757)
@@ -182,4 +182,5 @@
             Bug 1789 fixed - Escaping double quotes in text fields
             Bug 1790 fixed - Validation tracking tab is set when correct options are set
+            Bug 1795 fixed - Fixes rules using email information and/or email of validation
 */
 ?>
Index: /extensions/NBC_UserAdvManager/trunk/include/functions.inc.php
===================================================================
--- /extensions/NBC_UserAdvManager/trunk/include/functions.inc.php	(revision 6756)
+++ /extensions/NBC_UserAdvManager/trunk/include/functions.inc.php	(revision 6757)
@@ -388,4 +388,45 @@
     
     return get_absolute_root_url().UAM_PATH.'ConfirmMail.php?key='.$Confirm_Mail_ID;
+  }
+}
+
+
+/* Function called from main.inc.php to set group to new users if manual validation is set */
+function setgroup($user_id)
+{
+  global $conf;
+  
+  $conf_UAM = unserialize($conf['UserAdvManager']);
+
+  $query = "
+DELETE FROM ".USER_GROUP_TABLE."
+WHERE user_id = '".$user_id."'
+  AND (
+    group_id = '".$conf_UAM[2]."'
+  OR 
+    group_id = '".$conf_UAM[3]."'
+  )
+;";
+  pwg_query($query);
+
+  if (!is_admin() and $conf_UAM[8] <> -1)
+  {
+    $query = "
+UPDATE ".USER_INFOS_TABLE."
+SET status = '".$conf_UAM[8]."'
+WHERE user_id = '".$user_id."'
+;";
+    pwg_query($query);
+  }
+
+  if ( $conf_UAM[2] <> -1 )
+  {
+    $query = "
+INSERT INTO ".USER_GROUP_TABLE."
+  (user_id, group_id)
+VALUES
+  ('".$user_id."', '".$conf_UAM[2]."')
+;";
+    pwg_query($query);
   }
 }
Index: /extensions/NBC_UserAdvManager/trunk/language/de_DE/plugin.lang.php
===================================================================
--- /extensions/NBC_UserAdvManager/trunk/language/de_DE/plugin.lang.php	(revision 6756)
+++ /extensions/NBC_UserAdvManager/trunk/language/de_DE/plugin.lang.php	(revision 6757)
@@ -30,6 +30,5 @@
 $lang['Err_audit_advise'] = '<b>Sie müssen Korrekturen an mit neuen Regeln die Sie aktiviert haben, nachzukommen durchzuführen.<br>Verwenden Sie ein Datenbank-Management-Dienstprogramm, um Benutzer-Accounts direkt in der Tabelle richtig ###_USERS';
 $lang['UAM_Empty Author'] = 'Der Autor Feld müssen ausgefüllt werden um einen Kommentar zu schicken.';
-if ( isset($conf_UAM[1]) and $conf_UAM[1] == 'true' )
-	$lang['reg_err_login5'] = 'Benutzername bereits vorhanden, WARNUNG Name ist Groß-und Kleinschreibung.';
+$lang['reg_err_login5'] = 'Benutzername bereits vorhanden, WARNUNG Name ist Groß-und Kleinschreibung.';
 $lang['reg_err_login6'] = 'Benutzername muss nicht die folgenden Zeichen übereinstimmen: ';
 $lang['reg_err_login7'] = 'Ihre E-Mail-Anbieter für die Registrierung ist verboten. Gebannten E-Mail-Anbieter sind: ';
Index: /extensions/NBC_UserAdvManager/trunk/language/en_UK/plugin.lang.php
===================================================================
--- /extensions/NBC_UserAdvManager/trunk/language/en_UK/plugin.lang.php	(revision 6756)
+++ /extensions/NBC_UserAdvManager/trunk/language/en_UK/plugin.lang.php	(revision 6757)
@@ -29,6 +29,5 @@
 $lang['Err_audit_advise'] = '<b>you have to perform corrections to comply with new rules that you have activated.<br>Use a database management utility to correct user accounts directly in the table ###_USERS';
 $lang['UAM_Empty Author'] = 'The author field have to be filled to send a comment.';
-if ( isset($conf_UAM[1]) and $conf_UAM[1] == 'true' )
-	$lang['reg_err_login5'] = 'Username already exist, WARNING name is case insensitive (Shift = Tiny).';
+$lang['reg_err_login5'] = 'Username already exist, WARNING name is case insensitive (Shift = Tiny).';
 $lang['reg_err_login6'] = 'Username does not have to match the following characters: ';
 $lang['reg_err_login7'] = 'Your email provider is banned for registration. Banned email providers are: ';
Index: /extensions/NBC_UserAdvManager/trunk/language/es_ES/plugin.lang.php
===================================================================
--- /extensions/NBC_UserAdvManager/trunk/language/es_ES/plugin.lang.php	(revision 6756)
+++ /extensions/NBC_UserAdvManager/trunk/language/es_ES/plugin.lang.php	(revision 6757)
@@ -30,6 +30,5 @@
 $lang['Err_audit_advise'] = '<b>Usted tiene que realizar correcciones para cumplir con las nuevas normas que ha activado.<br>Use una herramienta de gestión de base de datos para corregir las cuentas de usuario directamente en la tabla ###_USERS';
 $lang['UAM_Empty Author'] = 'El campo de autor tienen que ser llenados para enviar un comentario.';
-if ( isset($conf_UAM[1]) and $conf_UAM[1] == 'true' )
-	$lang['reg_err_login5'] = 'Este nombre de usuario ya existe,  ADVERTENCIA se distinguen las mayúsculas (Shift = pequeño).';
+$lang['reg_err_login5'] = 'Este nombre de usuario ya existe,  ADVERTENCIA se distinguen las mayúsculas (Shift = pequeño).';
 $lang['reg_err_login6'] = 'El nombre de usuario no puede coincidir con los siguientes caracteres: ';
 $lang['reg_err_login7'] = 'Su proveedor de correo electrónico está prohibido para el registro. Proveedores de correo electrónico en veda son: ';
Index: /extensions/NBC_UserAdvManager/trunk/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/NBC_UserAdvManager/trunk/language/fr_FR/plugin.lang.php	(revision 6756)
+++ /extensions/NBC_UserAdvManager/trunk/language/fr_FR/plugin.lang.php	(revision 6757)
@@ -29,6 +29,5 @@
 $lang['Err_audit_advise'] = '<b>Vous avez des corrections a faire pour respecter les nouvelles règles que vous avez activées.<br>Utilisez un utilitaire de gestion de base de données pour corriger les comptes utilisateurs directement dans la table ###_USERS si nécessaire.</b><br><br>';
 $lang['UAM_Empty Author'] = 'Le champs auteur doit être rempli pour enregistrer un commentaire.';
-if ( isset($conf_UAM[1]) and $conf_UAM[1] == 'true' )
-	$lang['reg_err_login5'] = 'ce nom utilisateur est déjà pris, ATTENTION le nom est insensible à la casse (Majuscule = Minuscule).';
+$lang['reg_err_login5'] = 'ce nom utilisateur est déjà pris, ATTENTION le nom est insensible à la casse (Majuscule = Minuscule).';
 $lang['reg_err_login6'] = 'le nom utilisateur ne doit pas contenir les caractère suivants : ';
 $lang['reg_err_login7'] = 'L\'adresse email est issue d\'un prestataire interdit. Les prestataires d\'adresses email interdits à l\'inscription sont : ';
Index: /extensions/NBC_UserAdvManager/trunk/language/it_IT/plugin.lang.php
===================================================================
--- /extensions/NBC_UserAdvManager/trunk/language/it_IT/plugin.lang.php	(revision 6756)
+++ /extensions/NBC_UserAdvManager/trunk/language/it_IT/plugin.lang.php	(revision 6757)
@@ -30,6 +30,5 @@
 $lang['Err_audit_advise'] = '<b>Dovete eseguire delle correzioni per rispettare le nuove impostazzioni che avete attivato.<br> Utilizzare un programma per la gestione della base dati per correggere i conti utente direttamente nella tabella ###_USERS';
 $lang['UAM_Empty Author'] = 'Il campo autore deve essere riempito per potere inviare un commento.';
-if ( isset($conf_UAM[1]) and $conf_UAM[1] == 'true' )
-	$lang['reg_err_login5'] = 'Nome utente esiste già. Attenzione : il campo è insensibile alle maiuscole/minuscole.';
+$lang['reg_err_login5'] = 'Nome utente esiste già. Attenzione : il campo è insensibile alle maiuscole/minuscole.';
 $lang['reg_err_login6'] = 'Nome utente non deve contenere in caratteri seguenti: ';
 $lang['reg_err_login7'] = 'Il tuo provider di posta usa dominio d\'Email proibito. I domini preibiti sono i seguenti: ';
Index: /extensions/NBC_UserAdvManager/trunk/main.inc.php
===================================================================
--- /extensions/NBC_UserAdvManager/trunk/main.inc.php	(revision 6756)
+++ /extensions/NBC_UserAdvManager/trunk/main.inc.php	(revision 6757)
@@ -128,21 +128,39 @@
   $conf_UAM = unserialize($conf['UserAdvManager']);
   
-  /* 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'))
-  {
-    if (is_admin() and isset($conf_UAM[20]) and $conf_UAM[20] == 'true')
-    {
-    $passwd = (isset($_POST['password'])) ? $_POST['password'] : '';
-    SendMail2User(1, $register_user['id'], $register_user['username'], $passwd, $register_user['email'], true); 
-    }
-    elseif (is_admin() and isset($conf_UAM[20]) and $conf_UAM[20] == 'false')
-    {
+  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 */
     $passwd = (isset($_POST['password'])) ? $_POST['password'] : '';
     SendMail2User(1, $register_user['id'], $register_user['username'], $passwd, $register_user['email'], false);
+    setgroup($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 "wainting" group or status until admin validation */
+    setgroup($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 */
+    $passwd = (isset($_POST['password'])) ? $_POST['password'] : '';
+    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') and (isset($conf_UAM[1]) and $conf_UAM[1] == 'true'))
+  {
+    if (is_admin() and isset($conf_UAM[20]) and $conf_UAM[20] == 'true')
+    {
+      $passwd = (isset($_POST['password'])) ? $_POST['password'] : '';
+      SendMail2User(1, $register_user['id'], $register_user['username'], $passwd, $register_user['email'], true); 
+    }
+    elseif (is_admin() and isset($conf_UAM[20]) and $conf_UAM[20] == 'false')
+    {
+      $passwd = (isset($_POST['password'])) ? $_POST['password'] : '';
+      SendMail2User(1, $register_user['id'], $register_user['username'], $passwd, $register_user['email'], false);
     }
     elseif (!is_admin())
     {
-    $passwd = (isset($_POST['password'])) ? $_POST['password'] : '';
-    SendMail2User(1, $register_user['id'], $register_user['username'], $passwd, $register_user['email'], true);
+      $passwd = (isset($_POST['password'])) ? $_POST['password'] : '';
+      SendMail2User(1, $register_user['id'], $register_user['username'], $passwd, $register_user['email'], true);
     }
   }
@@ -337,5 +355,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'))
+      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;
@@ -350,8 +368,15 @@
           
           list($current_email) = pwg_db_fetch_row(pwg_query($query));
-      
-          if ($_POST['mail_address'] != $current_email and ( isset($conf_UAM[1]) and $conf_UAM[1] == 'true'))
+
+          /* This is to send a new validation key */
+          if ($_POST['mail_address'] != $current_email and (isset($conf_UAM[1]) and $conf_UAM[1] == 'true'))
         
             $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'))
+        
+            setgroup($register_user['id']);// Set to "waiting" group or status until admin validation
+            $confirm_mail_need = false;
         }
         
