coppermine-gallery.com/forum

Support => Older/other versions => cpg1.3.x Support => Topic started by: jtorral on May 01, 2005, 06:36:14 PM

Title: Listing users by clicking on a letter of their name
Post by: jtorral on May 01, 2005, 06:36:14 PM
Is there a way of seeing all users based on an alphabet selection? For example a list of a to z. if I click on say, D , I get a list of user whos names begin with D.  This would be very useful. Especially since I have nearly 2k users.

Thanks
Title: Re: Listing users by clicking on a letter of their name
Post by: Nibbler on May 01, 2005, 06:38:39 PM
Only the one you already know about.

http://forum.coppermine-gallery.net/index.php?topic=17334.0
Title: Re: Listing users by clicking on a letter of their name
Post by: jtorral on May 01, 2005, 06:42:49 PM
Could not get it going on cpg133. Thats why i asked again.  Hope its available in th enext version.

I actually created a dropdown list of the users where you can just select the user by name. But I cannot get it working on the templates.html

I wouldnt mind getting it to display near the top.  Think you could do it?  I will post the code in a minute.
Title: Re: Listing users by clicking on a letter of their name
Post by: jtorral on May 01, 2005, 06:47:38 PM
here is the code.  This shoud work with any site. I just need to get this on the template.html file some how.


<?php

include('/path/to/your/vb/config.php');

$connectstring = mysql_connect("$servername", "$dbusername", "$dbpassword");
mysql_select_db(rangefinder);

echo "<form method='get' name = 'albform' action='http://www.rangefinderforum.com/cpg/index.php?cat=$cat'>";

$query = "SELECT userid + 10000, username FROM user ORDER by username";

   $result = mysql_query($query, $connectstring);

   echo "<SELECT NAME='cat'>";
      while ( $fetched_row  = mysql_fetch_row($result) )
         {
            $cat = $fetched_row[0];
            $owner = strtoupper($fetched_row[1]);
           
            echo "<OPTION VALUE='$cat'>$owner</OPTION>";

         }

  echo "</SELECT>";

  echo "<INPUT TYPE='SUBMIT' VALUE='Go to Gallery'>";
  echo "</form>";


?>