Index: /extensions/see_photos_by_user/admin.php
===================================================================
--- /extensions/see_photos_by_user/admin.php	(revision 27391)
+++ /extensions/see_photos_by_user/admin.php	(revision 27391)
@@ -0,0 +1,68 @@
+<?php
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+global $template, $conf, $user;
+include_once(PHPWG_ROOT_PATH .'admin/include/tabsheet.class.php');
+load_language('plugin.lang', SPBA_PATH);
+$my_base_url = get_admin_plugin_menu_link(__FILE__);
+
+// +-----------------------------------------------------------------------+
+// | Check Access and exit when user status is not ok                      |
+// +-----------------------------------------------------------------------+
+check_status(ACCESS_ADMINISTRATOR);
+
+global $conf, $page;
+
+$template->assign(
+  array(
+    'SPBU1' => $conf['see_photos_by_user_nbphotos'],
+	'SPBU2' => $conf['see_photos_by_user_limit'],
+	'SPBU3' => $conf['see_photos_by_user_order'],
+    )
+  );
+  
+$SPBU3T = array(
+    l10n('users in alphabetical order'),
+    l10n('users by reverse alphabetical order'),
+    l10n('by increasing number of photos'),
+	l10n('by decreasing number of photos'),
+  );
+  
+$SPBU3 = array(
+    'username ASC',
+    'username DESC',
+    'PBU ASC',
+	'PBU DSC',
+  );
+
+$template->assign('spbu', $SPBU3);
+$template->assign('spbuT', $SPBU3T); 
+ 
+
+if (isset($_POST['submitspbu']))
+{
+if (is_numeric($_POST['insspbu1'])) 
+{conf_update_param('see_photos_by_user_nbphotos', $_POST['insspbu1']);}
+else
+{array_push( $page['errors'], l10n('numerique'));}
+if (is_numeric($_POST['insspbu2'])) 
+conf_update_param('see_photos_by_user_limit', $_POST['insspbu2']);
+else
+{array_push( $page['errors'], l10n('numerique'));}
+conf_update_param('see_photos_by_user_order', $_POST['insspbu3']);
+
+
+array_push( $page['infos'], l10n('ok') );
+  
+$template->assign(
+    array(
+      'SPBU1' => stripslashes($_POST['insspbu1']),
+	  'SPBU2' => stripslashes($_POST['insspbu2']),
+	  'SPBU3' => stripslashes($_POST['insspbu3']),
+      )
+    );
+
+}
+
+$template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/admin.tpl')); 
+$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
+?>
Index: /extensions/see_photos_by_user/admin.tpl
===================================================================
--- /extensions/see_photos_by_user/admin.tpl	(revision 27391)
+++ /extensions/see_photos_by_user/admin.tpl	(revision 27391)
@@ -0,0 +1,22 @@
+<div class="titrePage">
+  <h2>{'See photos by user'|@translate}</h2>
+</div>
+
+<form method="post">
+ <p>
+  <strong>{'Minimal number photos for show users'|@translate}</strong> 
+  <input type="text" name="insspbu1" value="{$SPBU1}" size="10" maxlength="10">
+ </p>
+ <p>
+  <strong>{'Maximal number users'|@translate}</strong> 
+  <input type="text" name="insspbu2" value="{$SPBU2}" size="10" maxlength="10">
+ </p>
+ <p>
+  <strong>{'users order'|@translate}</strong> 
+  {html_options name="insspbu3" values=$spbu output=$spbuT selected="{$SPBU3}"}
+ </p>
+
+  <p>
+    <input class="submit" type="submit" name="submitspbu" value="{'Submit'|@translate}">
+  </p>
+</form>
Index: /extensions/see_photos_by_user/language/en_UK/plugin.lang.php
===================================================================
--- /extensions/see_photos_by_user/language/en_UK/plugin.lang.php	(revision 27390)
+++ /extensions/see_photos_by_user/language/en_UK/plugin.lang.php	(revision 27391)
@@ -2,4 +2,13 @@
 $lang['See photos by user'] = 'See photos by user';
 $lang['select user'] = 'select user';
-$lang['sumit']= 'sumit';
+$lang['select other user'] = 'select other user';
+$lang['sumit'] = 'sumit';
+$lang['users in alphabetical order'] = 'users in alphabetical order';
+$lang['users by reverse alphabetical order'] = 'users by reverse alphabetical order';
+$lang['by increasing number of photos'] = 'by increasing number of photos';
+$lang['by decreasing number of photos'] = 'by decreasing number of photos';
+$lang['Minimal number photos for show users'] = 'Minimal number photos for show users';
+$lang['Maximal number users'] = 'Maximal number users';
+$lang['users order'] = 'users order';
+
 ?>
Index: /extensions/see_photos_by_user/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/see_photos_by_user/language/fr_FR/plugin.lang.php	(revision 27390)
+++ /extensions/see_photos_by_user/language/fr_FR/plugin.lang.php	(revision 27391)
@@ -1,5 +1,13 @@
 <?php
 $lang['See photos by user'] = 'Voir photos par utilisateur';
-$lang['select user'] = 'selectionne un utilisateur';
-$lang['sumit']= 'Valider';
+$lang['select user'] = 'selectionner un utilisateur';
+$lang['select other user'] = 'selectionner un autre utilisateur';
+$lang['sumit'] = 'Valider';
+$lang['users in alphabetical order'] = 'utilisateurs par ordre alphabètique';
+$lang['users by reverse alphabetical order'] = 'utilisateurs par ordre inversement alphabètique';
+$lang['by increasing number of photos'] = 'par nombre de photos croissant';
+$lang['by decreasing number of photos'] = 'par nombre de photos décroissant';
+$lang['Minimal number photos for show users'] = 'Mombre minimal de photos pour montrer les utilisateurs';
+$lang['Maximal number users'] = 'nombre maximal d\utilisateurs';
+$lang['users order'] = 'ordre des utilisateurs';
 ?>
Index: /extensions/see_photos_by_user/main.inc.php
===================================================================
--- /extensions/see_photos_by_user/main.inc.php	(revision 27390)
+++ /extensions/see_photos_by_user/main.inc.php	(revision 27391)
@@ -13,5 +13,7 @@
 define('SPBA_DIR' , basename(dirname(__FILE__)));
 define('SPBA_PATH' , PHPWG_PLUGINS_PATH . SPBA_DIR . '/');
+load_language('plugin.lang', SPBA_PATH);
 
+add_event_handler('blockmanager_apply' , 'add_link_SPBA');
 function add_link_SPBA($menu_ref_arr)
  {
@@ -24,8 +26,8 @@
    array_splice
 	 ($block->data, $position-1, 0, array
-	  ('See_photos_by_user' =>
+	  ('user-' =>
       array
 			 (
-			 'URL' => make_index_url(array('section' => 'See_photos_by_user')),
+			 'URL' => make_index_url(array('section' => 'user-')),
 			 'TITLE' => l10n('See photos by user'),
 			 'NAME' => l10n('See photos by user')
@@ -36,14 +38,33 @@
  }
 
+add_event_handler('loc_end_section_init', 'section_init_SPBA');
 function section_init_SPBA()
 {
-  global $tokens;
-  if (in_array('See_photos_by_user', $tokens))
-  include(SPBA_PATH . 'pagespba.php');
+ global $tokens;
+$testd = explode('user-', $_SERVER['REQUEST_URI']); 
+if (!empty ($testd[1]))
+{$me = 'user-'.$testd[1];}
+else
+{$me = 'user-';}
+
+ if (in_array($me, $tokens))
+ include(SPBA_PATH . 'pagespba.php');
 }
 
-add_event_handler('blockmanager_apply' , 'add_link_SPBA');
-add_event_handler('loc_end_section_init', 'section_init_SPBA');
 
+add_event_handler('get_admin_plugin_menu_links', 'SPBA_admin_menu');
+function SPBA_admin_menu($menu)
+{
+  array_push(
+    $menu,
+    array(
+      'NAME' => l10n('See photos by user'),
+      'URL' => get_admin_plugin_menu_link(SPBA_PATH . 'admin.php')
+	  //'URL' => get_root_url().'admin.php?page=plugin-See_photos_by_user'
+      )
+    );
+  
+  return $menu;
+}
 
 ?>
Index: /extensions/see_photos_by_user/maintain.inc.php
===================================================================
--- /extensions/see_photos_by_user/maintain.inc.php	(revision 27391)
+++ /extensions/see_photos_by_user/maintain.inc.php	(revision 27391)
@@ -0,0 +1,33 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+function plugin_activate()
+{
+ if (!isset($conf['see_photos_by_user_nbphotos']))
+ {
+ conf_update_param('see_photos_by_user_nbphotos', '0');
+ }
+  if (!isset($conf['see_photos_by_user_limit']))
+ {
+ conf_update_param('see_photos_by_user_limit', '1000');
+ }
+   if (!isset($conf['see_photos_by_user_order']))
+ {
+ conf_update_param('see_photos_by_user_order', 'username ASC');
+ }
+}
+
+function plugin_install()
+{	
+}
+
+function plugin_uninstall()
+{	
+conf_delete_param('see_photos_by_user_nbphotos');
+conf_delete_param('see_photos_by_user_limit');
+conf_delete_param('see_photos_by_user_order');
+}
+
+
+?>
Index: /extensions/see_photos_by_user/pagespba.php
===================================================================
--- /extensions/see_photos_by_user/pagespba.php	(revision 27390)
+++ /extensions/see_photos_by_user/pagespba.php	(revision 27391)
@@ -1,24 +1,91 @@
 <?php
-
 load_language('plugin.lang', SPBA_PATH);
 
 global $page, $conf, $user, $template;
-$page['section'] = 'See_photos_by_author';
-  
+
+$testd = explode('user-', $_SERVER['REQUEST_URI']); 
+if (!empty ($testd[1]))
+{$me = 'user-'.$testd[1];
+$page['section'] = $me;
+
+$query = '
+SELECT id, username
+ FROM ' . USERS_TABLE . '
+ WHERE username = \''.$testd[1].'\'
+;';
+$result = pwg_query($query);
+$row = pwg_db_fetch_assoc($result);
+  $template->assign(
+    'gestionB',
+    array(
+      'USERUSBU' => $testd[1],
+      ));
+
+$query = '
+SELECT DISTINCT(id)
+ FROM '.IMAGES_TABLE.'
+ INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id
+ '.get_sql_condition_FandF
+  (
+    array
+      (
+        'forbidden_categories' => 'category_id',
+        'visible_categories' => 'category_id',
+        'visible_images' => 'id'
+      ),
+    'WHERE'
+  ).'
+ AND added_by = \''.$row['id'].'\'
+ '.$conf['order_by'].'
+;';
+$page = array_merge
+(
+ $page,
+ array
+ (
+'title' => '<a href="'.duplicate_index_url(array('start'=>0)).'">'.$me.'</a>',
+'items' => array_from_query($query, 'id'),
+ )
+);
+}
+else
+{
+$me = 'user-';
+$page['section'] = $me;
+}
 //read auteur list
 $groups = array();
+
 $query = '
-select id,username
-  FROM ' . USERS_TABLE . '
-  WHERE id<>2 
-  ORDER BY username ASC;';
+SELECT UT.id, UT.username, COUNT(IT.id) AS PBU, IT.id
+ FROM ' . USERS_TABLE . ' as UT
+ INNER JOIN '.IMAGES_TABLE.' AS IT ON IT.added_by = UT.id
+ INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON IT.id = ic.image_id
+  '.get_sql_condition_FandF
+  (
+    array
+      (
+        'forbidden_categories' => 'category_id',
+        'visible_categories' => 'category_id',
+        'visible_images' => 'id'
+      ),
+    'WHERE'
+  ).'
+ GROUP BY IT.added_by
+ HAVING PBU >'.$conf['see_photos_by_user_nbphotos'].'
+ ORDER BY '.$conf['see_photos_by_user_order'].'
+ LIMIT '.$conf['see_photos_by_user_limit'].';';
+
 $result = pwg_query($query);
 
 while ($row = pwg_db_fetch_assoc($result))
  {
-  $groups[$row['id']] = $row['username'];
+  $groups[$row['username']] = $row['username'].' ('.$row['PBU'].')';
 }
   $selected = 0;
-	$options[] = l10n('select user');
+  if (empty ($testd[1]))
+	{$options[] = l10n('select user');}
+ else
+  {$options[] = l10n('select other user');}
 	$options['a'] = '----------------------';
 
@@ -36,57 +103,10 @@
 if (isset($_POST['submitchoixauteur']))
  {
-     $forbidden = get_sql_condition_FandF(
-     array( 'visible_images' => 'id' ),
-    'AND'
-          );
-	  
-  $page['section'] = 'See_photos_by_author';
+ $redirect_url = get_root_url().'index.php?/user-'.($_POST['metalist']);
+ redirect($redirect_url);
+ }
 
-    $query = '
-  SELECT DISTINCT(id)
-  FROM '.IMAGES_TABLE.'
-  INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id
-  WHERE added_by = \''.$_POST['metalist'].'\'
-    '.$forbidden.'
-    '.$conf['order_by'].'
-  ;';
-
-   $page = array_merge(
-  $page,
-  array(
-    'title' => '<a href="'.duplicate_index_url(array('start'=>0)).'">'.l10n('See photos by author').'</a>',
-    'items' => array_from_query($query, 'id'),
-      )
-     );
-	  
-//read auteur list
-$groups = array();
-$query = '
- select id,username
-  FROM ' . USERS_TABLE . '
-  WHERE id<>2 
-  ORDER BY username ASC;';
-$result = pwg_query($query);
-
-while ($row = pwg_db_fetch_assoc($result))
-	{
-  $groups[$row['id']] = $row['username'];
-	}
-  $selected = $_POST['metalist'];
-
-  foreach ($groups as $metalist => $metalist2)
-	{
-    $options[$metalist] = $metalist2;
-	}
-  $template->assign(
-    'gestionA',
-    array(
-     'OPTIONS' => $options,
-     'SELECTED' => $selected
-     ));
- }
 $template->assign('SPBA2', 'toto');
 $template->set_filename('SPBA', realpath(SPBA_PATH.'pagespba.tpl'));
 $template->assign_var_from_handle('CONTENT', 'SPBA');
-
 ?>
Index: /extensions/see_photos_by_user/pagespba.tpl
===================================================================
--- /extensions/see_photos_by_user/pagespba.tpl	(revision 27390)
+++ /extensions/see_photos_by_user/pagespba.tpl	(revision 27391)
@@ -4,2 +4,5 @@
  </form>
 {/if}
+{if isset ($gestionB)}
+<h1>{'User'|@translate} {$gestionB.USERUSBU}</h1>
+{/if}
