Index: extensions/user_custom_fields/admin.php
===================================================================
--- extensions/user_custom_fields/admin.php	(revision 31541)
+++ extensions/user_custom_fields/admin.php	(revision 31542)
@@ -38,4 +38,7 @@
   $tabsheet = new tabsheet();
   $tabsheet->add('ucf', l10n('User custom fields'), UCF_ADMIN . '-define_custom');
+  if (isset($_GET['ucfiduser'])) {
+    $tabsheet->add('edit_user', l10n('User').' '.$_GET['ucfusername'], UCF_ADMIN . '-edit_user');
+  }
   $tabsheet->select($page['tab']);
   $tabsheet->assign();
@@ -46,5 +49,5 @@
 	$template->assign(
 		'addinfotemplate', array(
-		'addinfo' => l10n('addinfo'),
+		'toto' => l10n('toto'),
 	));
         
@@ -89,4 +92,5 @@
                 }else{
 				    $items['UCFWORDING'] = trigger_change('AP_render_content',$user_custom_fields['wording']);
+					$items['UCFWORDING2'] = $user_custom_fields['wording'];
 					$items['UCFOBLO'] = 1;
                 }        
@@ -107,5 +111,5 @@
             mass_updates(UCF_TABLE, $fields, $data);
 
-          $page['infos'][] = l10n('Properties manual order was saved');
+          $page['infos'][] = l10n('Custom fields manual order was saved');
           redirect($admin_base_url);
         }
@@ -199,5 +203,62 @@
             pwg_query($query);
 		}
-        break;
+  break;
+  case 'edit_user':
+    if (isset($_GET['ucfiduser']) and isset($_GET['ucfusername'])) {
+      check_input_parameter('ucfiduser', $_GET, false, PATTERN_ID);
+	  $PAED = pwg_db_fetch_assoc(pwg_query("SELECT state FROM " . PLUGINS_TABLE . " WHERE id = 'ExtendedDescription';"));
+		if($PAED['state'] == 'active'){
+		  add_event_handler('AP_render_content', 'get_user_language_desc');
+		  $template->assign('useED',1);
+		}else{
+		  $template->assign('useED',0);
+		}
+	  $template->assign(
+		'editusertemplate', array(
+		'toto' => l10n('toto'),
+	  ));
+	  $tab_user_custom_fields_adminlist=tab_user_custom_fields_adminlist();
+      $template->assign('UCF_USERNAME',$_GET['ucfusername']);
+	  $template->assign('UCF_USERID',$_GET['ucfiduser']);
+	  while ($info_users = pwg_db_fetch_assoc($tab_user_custom_fields_adminlist)) {
+		
+		$d=data_info_user($_GET['ucfiduser'],$info_users['id_ucf']);
+		$row = pwg_db_fetch_assoc($d);
+		$items = array(
+			'UCFID' => $info_users['id_ucf'],
+			'UCFWORDING' => trigger_change('AP_render_content', $info_users['wording']),
+			'UCFOBLIGATORY' => $info_users['obligatory'],
+			'UCFADMINONLY' => $info_users['adminonly'],
+			'UCFDATA' => $row['data'],
+		);
+		$template->append('tab_user_custom_fields_adminlist', $items);
+	  }
+    }else{
+	redirect(UCF_ADMIN . '-define_custom');
+	}
+	
+  if (isset($_POST['submitUCFa'])) {
+   foreach ($_POST['data'] AS $id_ucf => $data) {
+	$q = 'SELECT 1 FROM ' . UCFD_TABLE . ' WHERE id_user=' . $_POST['invisibleUSERID'] . ' AND id_ucf=' . $id_ucf;
+	$test = pwg_query($q);
+	$row = pwg_db_fetch_assoc($test);
+	if (count($row) > 0){
+	  if ($data != ''){
+		$query = 'UPDATE ' . UCFD_TABLE . ' SET data="' . $data . '" WHERE id_user=' . $_POST['invisibleUSERID'] . ' AND id_ucf=' . $id_ucf;
+		pwg_query($query);
+	  }else{
+		$query = 'DELETE FROM ' . UCFD_TABLE . ' WHERE id_user=' . $_POST['invisibleUSERID'] . ' AND id_ucf=' . $id_ucf;
+		pwg_query($query);
+	  }
+	}else if ($data != ''){
+		$query = 'INSERT ' . UCFD_TABLE . '(id_user,id_ucf,data) VALUES (' . $_POST['invisibleUSERID'] . ',' . $id_ucf . ',"' . $data . '");';
+		pwg_query($query);
+	}
+   }
+  $_SESSION['page_infos'] = array(l10n('Data custom fields update'));
+  redirect(get_root_url().'admin.php?page=user_list');
+  }
+	
+  break;
  }
 
Index: extensions/user_custom_fields/admin.tpl
===================================================================
--- extensions/user_custom_fields/admin.tpl	(revision 31541)
+++ extensions/user_custom_fields/admin.tpl	(revision 31542)
@@ -172,5 +172,5 @@
 
 <div class="titrePage">
-  <h2>{'Manage properties photos'|@translate}</h2>
+  <h2>{'Manage user custom filds'|@translate}</h2>
 </div>
 {if isset ($addinfotemplate)}
@@ -181,5 +181,5 @@
         <form method="post" >
             <fieldset>
-                <legend><span id="leg_add">{'Create new custom filds'|@translate}</span><span id="leg_edit">{'Edit Property photo'|@translate}</span></legend>
+                <legend><span id="leg_add">{'Create new custom filds'|@translate}</span><span id="leg_edit">{'Edit custom filds'|@translate}</span></legend>
                 <input id="hideid" type="hidden" name="invisibleID" value="{$addinfo_edit2.AIPID}">
                 <p class="input">
@@ -195,9 +195,9 @@
                 </p>
 				<p class="input" style="width: 700px;">
-                    <label for="adminonly">{'admin only'|@translate}</label>
+                    <label for="adminonly">{'Admin only'|@translate}</label>
                     <input id="aip_adminonly" type="checkbox" name="adminonly" {if {$addinfo_edit2.UCFADMINONLY}==1}checked{/if} value="1">
                 </p>
 				<p class="input" style="width: 700px;">
-                    <label for="obligatory">{'obligatory'|@translate}</label>
+                    <label for="obligatory">{'Obligatory'|@translate}</label>
                     <input id="aip_obligatory" type="checkbox" name="obligatory" {if {$addinfo_edit2.UCFOBLIGATORY}==1}checked{/if} value="1">
                 </p>
@@ -215,5 +215,5 @@
         </p>
 	<fieldset>
-	<legend>{'Custom fields List'|@translate}</legend>
+	<legend>{'Fields List'|@translate}</legend>
           <ul class="categoryUl">
             {foreach from=$user_custom_fields item=ucf}
@@ -229,12 +229,12 @@
                     {/if}
 					{if ($ucf.UCFEDIT==1)}
-					| <span id="edit_libinfo{$ucf.IDUCF}" class="edit_libinfo mouse icon-pencil" data-id="{$ucf.IDUCF}" data-lib="{$ucf.UCFWORDING}" data-hide="{$ucf.UCFACTIVE}" data-adminonly="{$ucf.UCFADMINONLY}" data-obligatory="{$ucf.UCFOBLIGATORY}"/>{'Edit'|@translate}</span>
+					| <span id="edit_libinfo{$ucf.IDUCF}" class="edit_libinfo mouse icon-pencil" data-id="{$ucf.IDUCF}" data-lib="{$ucf.UCFWORDING2}" data-hide="{$ucf.UCFACTIVE}" data-adminonly="{$ucf.UCFADMINONLY}" data-obligatory="{$ucf.UCFOBLIGATORY}"/>{'Edit'|@translate}</span>
 					| <a href="{$ucf.U_DELETE}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');"><span class="icon-trash"></span>{'delete'|@translate}</a>
-					|<span id="ppadminonlyh{$ucf.IDUCF}" {if ($ucf.UCFADMINONLY==1)}style="display: none"{/if}class="graphicalCheckbox icon-check-empty mouse ppadminonlyh" data-id="{$ucf.IDUCF}" data-link3="{$ucf.U_ADMINONLYHIDE}">{'admin only'|@translate}</span>
-                    <span id="ppadminonlys{$ucf.IDUCF}" {if ($ucf.UCFADMINONLY==0)}style="display: none"{/if}class="graphicalCheckbox icon-check mouse ppadminonlys" data-id="{$ucf.IDUCF}" data-link3="{$ucf.U_ADMINONLYSHOW}">{'admin only'|@translate}</span>
+					|<span id="ppadminonlyh{$ucf.IDUCF}" {if ($ucf.UCFADMINONLY==1)}style="display: none"{/if}class="graphicalCheckbox icon-check-empty mouse ppadminonlyh" data-id="{$ucf.IDUCF}" data-link3="{$ucf.U_ADMINONLYHIDE}">{'Admin only'|@translate}</span>
+                    <span id="ppadminonlys{$ucf.IDUCF}" {if ($ucf.UCFADMINONLY==0)}style="display: none"{/if}class="graphicalCheckbox icon-check mouse ppadminonlys" data-id="{$ucf.IDUCF}" data-link3="{$ucf.U_ADMINONLYSHOW}">{'Admin only'|@translate}</span>
                     {/if}
 					{if ($ucf.UCFOBLO==1)}
-					|<span id="ppobligatoryh{$ucf.IDUCF}" {if ($ucf.UCFOBLIGATORY==1)}style="display: none"{/if}class="graphicalCheckbox icon-check-empty mouse ppobligatoryh" data-id="{$ucf.IDUCF}" data-link4="{$ucf.U_OBLIGATORYHIDE}">{'obligatory'|@translate}</span>
-					<span id="ppobligatorys{$ucf.IDUCF}" {if ($ucf.UCFOBLIGATORY==0)}style="display: none"{/if}class="graphicalCheckbox icon-check mouse ppobligatorys" data-id="{$ucf.IDUCF}" data-link4="{$ucf.U_OBLIGATORYSHOW}">{'obligatory'|@translate}</span>
+					|<span id="ppobligatoryh{$ucf.IDUCF}" {if ($ucf.UCFOBLIGATORY==1)}style="display: none"{/if}class="graphicalCheckbox icon-check-empty mouse ppobligatoryh" data-id="{$ucf.IDUCF}" data-link4="{$ucf.U_OBLIGATORYHIDE}">{'Obligatory'|@translate}</span>
+					<span id="ppobligatorys{$ucf.IDUCF}" {if ($ucf.UCFOBLIGATORY==0)}style="display: none"{/if}class="graphicalCheckbox icon-check mouse ppobligatorys" data-id="{$ucf.IDUCF}" data-link4="{$ucf.U_OBLIGATORYSHOW}">{'Obligatory'|@translate}</span>
 					{/if}
 				</span>
@@ -246,31 +246,30 @@
     </form>
 {/if}
-{if isset ($gestionD)}
-<div>
-    <form method="post" >
-	<fieldset>
-	<legend>{'Properties additionals'|@translate}</legend>
-        <table>
-            {foreach from=$info_photos item=infophoto}
-            <tr>
-                <td style="width: 100px;"><span style="font-weight: bold; text-align: right;" >{$infophoto.UCFWORDING}</span></td>
-                <td><input type="text" size="150" maxlength="250" {if $useED==1}placeholder="{'Use Extended Description tags...'|@translate}"{/if} name="data[{$infophoto.IDUCF}]" value="{$infophoto.UCFDATA}" /></td>
-            </tr>  
-            {/foreach}
-            <tr style="text-align: right;">
-                <td colspan="2">
-                    {if $useED==1}
-                        <a href="{$ROOT_URL}admin/popuphelp.php?page=extended_desc" onclick="popuphelp(this.href); return false;" title="{'Use Extended Description tags...'|translate}" style="vertical-align: middle; border: 0; margin: 0.5em;"><img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/help.png" class="button" alt="{'Use Extended Description tags...'|translate}'"></a>
-                    {/if}
-                </td>
-            </tr>
-            <tr>
-                <td colspan="2">
-                    <input class="submit" name="submitaddinfoimg" type="submit" value="{'Save'|@translate}" />
-                </td>
-           </tr>
-           </table>
-  	</fieldset>
-    </form>
-</div>
+{if isset ($editusertemplate)}
+<form method="post" name="ucfprofile" id="ucfprofile" class="properties">
+ <input id="hideuserid" type="hidden" name="invisibleUSERID" value="{$UCF_USERID}">
+ <fieldset>
+  <legend>{$UCF_USERNAME}</legend>
+    <ul>
+      {foreach from=$tab_user_custom_fields_adminlist item=userinfo}
+		{if $userinfo.UCFID == 1}
+		{else if $userinfo.UCFID == 2}
+		{else if $userinfo.UCFID == 3}
+		{else if $userinfo.UCFID == 4}
+		{else if}
+		  <li>
+			<span class="property">
+              <label for="login">{$userinfo.UCFWORDING}</label>
+			</span>
+			<input type="text" name="data[{$userinfo.UCFID}]" id="data[{$userinfo.UCFID}]" value="{$userinfo.UCFDATA}"> {if $userinfo.UCFADMINONLY==1}{'Admin only'|@translate}{/if}
+		  </li>
+        {/if}
+	  {/foreach}
+  </ul>
+  <p class="actionButtons">
+	<input class="submit" name="submitUCFa" type="submit" value="{'Submit'|@translate}" />
+	<a href="#" id="addinfoClose">{'Cancel'|@translate}</a>
+  </p>
+ </fieldset>
+</form>
 {/if}
Index: extensions/user_custom_fields/include/function.inc.php
===================================================================
--- extensions/user_custom_fields/include/function.inc.php	(revision 31541)
+++ extensions/user_custom_fields/include/function.inc.php	(revision 31542)
@@ -56,3 +56,16 @@
 }
 
+function tab_user_custom_fields_adminlist($id_ucf=NULL){
+  $query = '
+    SELECT id_ucf,wording,order_ucf,active,edit,adminonly,obligatory
+    FROM ' . UCF_TABLE;
+ $query .= ' WHERE edit=1'; 
+   if($id_ucf!=null){
+      $query .= ' AND id_ucf='.$id_ucf;
+    }
+  $query .= ' ORDER BY order_ucf ASC
+  ;';
+  return pwg_query($query);
+}
+
 ?>
Index: extensions/user_custom_fields/initadmin.php
===================================================================
--- extensions/user_custom_fields/initadmin.php	(revision 31541)
+++ extensions/user_custom_fields/initadmin.php	(revision 31542)
@@ -32,3 +32,23 @@
 
 //ajouter filtre sur page option pour supprimer email obligatoire
+
+add_event_handler('loc_begin_admin_page', 'ucf_add_popin');
+function ucf_add_popin(){
+  global $template;
+  $template->set_prefilter('user_list', 'ucf_add_popin_prefilter');
+  $template->set_prefilter('config', 'ucf_config_prefilter');
+}
  
+function ucf_add_popin_prefilter($content, &$smarty){
+  $search = '#</div>\s*<div class="userPropertiesSet userPrefs">#ms';
+  return preg_replace($search, '<div class="userProperty"><a href="'.UCF_ADMIN.'-edit_user&amp;ucfiduser=<%- user.id %>&amp;ucfusername=<%- user.username %>"><span class="icon-pencil"></span>{\'Edit custom fields\'|@translate}</a></div></div><div class="userPropertiesSet userPrefs">', $content);
+}
+
+function ucf_config_prefilter($content, &$smarty){
+  $search = '#(      <li>
+        <label class="font-checkbox">
+          <span class="icon-check"></span>
+          <input type="checkbox" name="obligatory_user_mail_address").*(</label>
+      </li>)#ms';
+  return preg_replace($search, '', $content);
+}
Index: extensions/user_custom_fields/initprofile.php
===================================================================
--- extensions/user_custom_fields/initprofile.php	(revision 31541)
+++ extensions/user_custom_fields/initprofile.php	(revision 31542)
@@ -24,5 +24,5 @@
 
 function ucfPI(){
-  global $template, $prefixeTable, $userdata;
+  global $template;
   $template->set_prefilter('profile_content', 'ucfPT');
   $template->set_filename('ucf_profile_add', realpath(UCF_PATH.'ucf_profile_add.tpl'));
Index: extensions/user_custom_fields/language/en_UK/description.txt
===================================================================
--- extensions/user_custom_fields/language/en_UK/description.txt	(revision 31542)
+++ extensions/user_custom_fields/language/en_UK/description.txt	(revision 31542)
@@ -0,0 +1,1 @@
+Add User Custom Fields
Index: extensions/user_custom_fields/language/en_UK/index.php
===================================================================
--- extensions/user_custom_fields/language/en_UK/index.php	(revision 31542)
+++ extensions/user_custom_fields/language/en_UK/index.php	(revision 31542)
@@ -0,0 +1,8 @@
+<?php
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: extensions/user_custom_fields/language/en_UK/plugin.lang.php
===================================================================
--- extensions/user_custom_fields/language/en_UK/plugin.lang.php	(revision 31542)
+++ extensions/user_custom_fields/language/en_UK/plugin.lang.php	(revision 31542)
@@ -0,0 +1,35 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | User Custom Fields plugin for Piwigo                                  |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2016 ddtddt                    http://temmii.com/piwigo/ |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+$lang['User custom fields'] = 'User custom fields';
+$lang['Custom fields manual order was saved'] = 'Custom fields manual order was saved';
+$lang['Custom fields add'] = 'Custom fields add';
+$lang['Custom fields update'] = 'Custom fields update';
+$lang['Custom fields delete'] = 'Custom fields delete';
+$lang['Data custom fields update'] = 'Data custom fields update';
+$lang['Manage custom filds'] = 'Manage custom filds';
+$lang['Create new custom filds'] = 'Create new custom filds';
+$lang['Edit custom filds'] = 'Edit custom filds';
+$lang['Wording'] = 'Wording';
+$lang['Admin only'] = 'Admin only';
+$lang['Obligatory'] = 'Obligatory';
+$lang['Fields List'] = 'Fields List';
+
+?>
Index: extensions/user_custom_fields/language/fr_FR/description.txt
===================================================================
--- extensions/user_custom_fields/language/fr_FR/description.txt	(revision 31542)
+++ extensions/user_custom_fields/language/fr_FR/description.txt	(revision 31542)
@@ -0,0 +1,1 @@
+Ajouter des champs utilisateurs personalisés
Index: extensions/user_custom_fields/language/fr_FR/index.php
===================================================================
--- extensions/user_custom_fields/language/fr_FR/index.php	(revision 31542)
+++ extensions/user_custom_fields/language/fr_FR/index.php	(revision 31542)
@@ -0,0 +1,8 @@
+<?php
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: extensions/user_custom_fields/language/fr_FR/plugin.lang.php
===================================================================
--- extensions/user_custom_fields/language/fr_FR/plugin.lang.php	(revision 31542)
+++ extensions/user_custom_fields/language/fr_FR/plugin.lang.php	(revision 31542)
@@ -0,0 +1,35 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | User Custom Fields plugin for Piwigo                                  |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2016 ddtddt                    http://temmii.com/piwigo/ |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+$lang['User custom fields'] = 'Champs personnalisés de l\'utilisateur';
+$lang['Custom fields manual order was saved'] = 'L\'ordre manuel des champs de l\'utilisateur a été sauvegardé';
+$lang['Custom fields add'] = 'Champs utilisateur ajoutée';
+$lang['Custom fields update'] = 'Champs utilisateur mise à jour';
+$lang['Custom fields delete'] = 'Champs utilisateur supprimée';
+$lang['Data custom fields update'] = 'Données des champs pour l\'utilisateur mises à jour';
+$lang['Manage user custom filds'] = 'Gérer Manage custom filds';
+$lang['Create new custom filds'] = 'Créer un nouveau champs personnalisé';
+$lang['Edit custom filds'] = 'Editer champs personnalisé';
+$lang['Wording'] = 'Libellé';
+$lang['Admin only'] = 'Seulement l\'administrateur';
+$lang['Obligatory'] = 'Obligatoire';
+$lang['Fields List'] = 'Liste des Champs';
+
+?>
Index: extensions/user_custom_fields/language/index.php
===================================================================
--- extensions/user_custom_fields/language/index.php	(revision 31542)
+++ extensions/user_custom_fields/language/index.php	(revision 31542)
@@ -0,0 +1,8 @@
+<?php
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
