Index: extensions/Register_FluxBB/admin/admin.php
===================================================================
--- extensions/Register_FluxBB/admin/admin.php	(revision 22091)
+++ extensions/Register_FluxBB/admin/admin.php	(revision 22092)
@@ -876,4 +876,19 @@
 
     $msg_error_FluxBB2PWG .= '><img src="'.REGFLUXBB_PATH.'/admin/template/icon/user_delete.png" alt="'.l10n('Del_User').stripslashes($row['username']).'" /></a>';
+
+    $msg_error_FluxBB2PWG .= ' <a href="';
+
+    $msg_error_FluxBB2PWG .= add_url_params($page_Register_FluxBB_admin, array(
+      'action' => 'add2pwg',
+      'id' => $row['id'],
+      'username' => $row['username'],
+      'email' => $row['email'],
+    ));
+
+    $msg_error_FluxBB2PWG .= '" title="'.l10n('Add_User2pwg').stripslashes($row['username']).'"';
+
+    $msg_error_FluxBB2PWG .= $conf_Register_FluxBB['FLUXBB_CONFIRM']=='false' ?  ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' ';
+
+    $msg_error_FluxBB2PWG .= '><img src="'.REGFLUXBB_PATH.'/admin/template/icon/user_add.png" alt="'.l10n('Add_User2pwg').stripslashes($row['username']).'" /></a>';
   }
 
@@ -995,4 +1010,13 @@
 
   Audit_PWG_FluxBB();
+}
+else if (isset($_GET['action']) and ($_GET['action']=='add2pwg') and isset($_GET['id']) and isset($_GET['username']) and isset($_GET['email']))
+{
+  $error = Synch_Piwigo_Adduser($_GET['id'], $_GET['username'], $_GET['email']);
+  
+  if (!$error)
+    Audit_PWG_FluxBB();
+  else
+    $template->append('errors', l10n('RegFluxBB_Email_or_Username_already_exist'));
 }
 
Index: extensions/Register_FluxBB/changelog.txt.php
===================================================================
--- extensions/Register_FluxBB/changelog.txt.php	(revision 22091)
+++ extensions/Register_FluxBB/changelog.txt.php	(revision 22092)
@@ -125,4 +125,9 @@
 
 2.5.6 - Bug fixed : Message for password change request not displayed on profile page
+
+2.5.7 - Rebuild of previous version due to file corruption
+
+2.5.8 - Add accounts synchronization from FluxBB to Piwigo
+      - Bug fixed : Missing function in audit
 */
 ?>
Index: extensions/Register_FluxBB/include/functions.inc.php
===================================================================
--- extensions/Register_FluxBB/include/functions.inc.php	(revision 22091)
+++ extensions/Register_FluxBB/include/functions.inc.php	(revision 22092)
@@ -640,4 +640,154 @@
 
 /**
+ * Add new registered user in Piwigo users table from audit/synch action
+ * To solve password synch problem, passwords are reset to NULL to force users to get a new password on their profile page
+ * 
+ * @return : $error
+ */
+function Synch_Piwigo_Adduser($fluxbb_id, $username, $email)
+{
+  global $conf;
+  load_language('plugin.lang', REGFLUXBB_PATH);
+
+  if (!get_userid_by_email($email) and !get_userid($username))
+  {
+    // find a password
+    $password = generate_key(8);
+
+    $error = register_user($username, $password, $email, false);
+
+    if (empty($error))
+    {
+      include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
+
+      $keyargs_content = array(
+        get_l10n_args('Hello %s,', $login),
+        get_l10n_args('To synchronize your forum access with the gallery you have been registered at %s!', $conf['gallery_title']),
+        get_l10n_args('', ''),
+        get_l10n_args('Here are your connection settings', ''),
+        get_l10n_args('Username: %s', $login),
+        get_l10n_args('Password: %s', $password),
+        get_l10n_args('Email: %s', $mail_address),
+        get_l10n_args('', ''),
+        get_l10n_args('Please change your password at your first connexion on the gallery', ''),
+        get_l10n_args('', ''),
+        get_l10n_args('If you think you\'ve received this email in error, please contact us at %s', get_webmaster_mail_address()),
+      );
+
+      pwg_mail(
+        $mail_address,
+        array(
+          'subject' => '['.$conf['gallery_title'].'] '.l10n('Registration'),
+          'content' => l10n_args($keyargs_content),
+          'content_format' => 'text/plain',
+          )
+      );
+
+      $pwg_id = get_userid($username);
+
+      FluxBB_Linkuser($pwg_id, $fluxbb_id, "NOK");
+      
+      $error = false;
+    }
+  }
+  else $error = true;
+
+  return $error;
+}
+
+
+/**
+ * Update user information in FluxBB users table from audit/synch action
+ * Standard FluxBB_Updateuser() function is not used because of existing password mismatch
+ * To solve password synch problem, passwords are reset to NULL to force users to get a new password by using "forgotten password" function
+ */
+function Synch_FluxBB_Updateuser($pwg_id, $username, $adresse_mail)
+{
+  global $conf;
+  
+  include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
+  $conf_Register_FluxBB = unserialize($conf['Register_FluxBB']);
+  $password = NULL;
+
+// Select users to update in ID link table
+  $query = '
+SELECT id_user_FluxBB as FluxBB_id
+FROM '.Register_FluxBB_ID_TABLE.'
+WHERE id_user_pwg = '.$pwg_id.'
+;';
+
+  $row = pwg_db_fetch_assoc(pwg_query($query));
+
+  if (!empty($row))
+  {
+    $query = '
+UPDATE '.FluxBB_USERS_TABLE.'
+SET username = "'.pwg_db_real_escape_string($username).'", email = "'.$adresse_mail.'", password = "'.$password.'" 
+WHERE id = '.$row['FluxBB_id'].'
+AND "'.pwg_db_real_escape_string($username).'" NOT IN ("18","16")
+AND "'.pwg_db_real_escape_string($username).'" <> "'.stripslashes($conf_Register_FluxBB['FLUXBB_ADMIN']).'"
+;';
+
+    pwg_query($query);
+
+    FluxBB_Linkuser($pwg_id, $row['FluxBB_id'], "NOK");
+  }
+  else
+  {
+    $query = '
+SELECT id as FluxBB_id
+FROM '.FluxBB_USERS_TABLE.'
+WHERE BINARY username = BINARY "'.pwg_db_real_escape_string($username).'"
+AND "'.pwg_db_real_escape_string($username).'" <> "'.stripslashes($conf_Register_FluxBB['FLUXBB_ADMIN']).'"
+;';
+
+    $row = pwg_db_fetch_assoc(pwg_query($query));
+
+    if (!empty($row))
+    {
+      $query = '
+UPDATE '.FluxBB_USERS_TABLE.'
+SET username = "'.pwg_db_real_escape_string($username).'", email = "'.$adresse_mail.'", password = "'.$password.'" 
+WHERE id = '.$row['FluxBB_id'].'
+AND "'.pwg_db_real_escape_string($username).'" NOT IN ("18","16")
+AND "'.pwg_db_real_escape_string($username).'" <> "'.stripslashes($conf_Register_FluxBB['FLUXBB_ADMIN']).'"
+;';
+
+      pwg_query($query);
+
+      FluxBB_Linkuser($pwg_id, $row['FluxBB_id'], "NOK");
+    }
+  }
+}
+
+
+/**
+ * Reg_FluxBB_PwdSynch
+ * Checks if a password needs to be resynch between Piwigo and FluxBB 
+ * 
+ * @uid        : the user id
+ * 
+ * @returns    : true if the password is NOT synchronized (NOK) else false
+ * 
+ */
+function Reg_FluxBB_PwdSynch($uid)
+{
+  $query = '
+SELECT PwdSynch
+FROM '.Register_FluxBB_ID_TABLE.'
+WHERE id_user_pwg='.$uid.'
+;';
+
+  $result = pwg_db_fetch_assoc(pwg_query($query));
+
+  if($result['PwdSynch'] == "NOK" or is_null($result['PwdSynch']))
+  {
+    return true;
+  }
+  else return false; 
+}
+
+
+/**
  * Search linked users
  */
Index: extensions/Register_FluxBB/language/en_UK/plugin.lang.php
===================================================================
--- extensions/Register_FluxBB/language/en_UK/plugin.lang.php	(revision 22091)
+++ extensions/Register_FluxBB/language/en_UK/plugin.lang.php	(revision 22092)
@@ -156,3 +156,8 @@
 
 $lang['RegFluxBB_Password_Reset_Msg'] = 'Please, update your password for synchronization with the forum. Then you will be able to connect to the forum with the same account as the gallery.';
+
+$lang['Add_User2pwg'] = 'Adding in Piwigo of account: ';
+$lang['RegFluxBB_Email_or_Username_already_exist'] = 'Synchronization from FluxBB to Piwigo stopped : Target email or username already exists in Piwigo users table.';
+$lang['To synchronize your forum access with the gallery you have been registered at %s!'] = 'To synchronize your forum access with the gallery you have been registered at %s!';
+$lang['Please change your password at your first connexion on the gallery'] = 'Please change your password at your first connexion on the gallery to end the data synchronization';
 ?>
Index: extensions/Register_FluxBB/language/fr_FR/plugin.lang.php
===================================================================
--- extensions/Register_FluxBB/language/fr_FR/plugin.lang.php	(revision 22091)
+++ extensions/Register_FluxBB/language/fr_FR/plugin.lang.php	(revision 22092)
@@ -157,3 +157,7 @@
 $lang['RegFluxBB_Password_Reset_Msg'] = 'Veuillez modifier votre mot de passe pour synchronisation avec l\'accès au forum. Vous pourrez alors vous connecter au forum avec le même compte que pour la galerie.';
 
+$lang['Add_User2pwg'] = 'Ajout dans Piwigo du compte : ';
+$lang['RegFluxBB_Email_or_Username_already_exist'] = 'Synchronisation de FluxBB vers Piwigo suspendue : L\'email ou le nom d\'utilisateur cible existe déjà dans la table des utilisateurs de Piwigo.';
+$lang['To synchronize your forum access with the gallery you have been registered at %s!'] = 'Afin de synchroniser votre compte d\'accès au forum avec la galerie, vous avez été inscrit sur %s!';
+$lang['Please change your password at your first connexion on the gallery'] = 'Merci de bien vouloir modifier votre mot de passe lors de votre première connexion à la galerie pour terminer la synchronisation des données.';
 ?>
