9
OK I've worked out a way to do this now. Thanks for everyones help.
1) I drop the following code into xoopslists (creates an array same as other lists)...
function &member_location ()
{
global $xoopsDB;
$locations = array();
$sql = "SELECT DISTINCT location FROM xoops_users ORDER BY location";
$result = mysql_query($sql);
while($location = $xoopsDB->fetchArray($result)){
$locations[$location['location']] = $location['location'];
}
return $locations;
}
2) Make a copy of formselectcountry and change the contents to
class XoopsFormSelectLocation extends XoopsFormSelect
{
function XoopsFormSelectLocation($caption, $name, $value=null, $size=1)
{
$this->XoopsFormSelect($caption, $name, $value, $size);
$this->addOptionArray(XoopsLists::member_location());
}
}
3) Save this as formselectlocation.php and add this to xoopsformloader.php
4) You can then use it in members/index.php the same as the other select form fields ie...
$location_text = new XoopsFormSelectLocation(_MM_COUNTRY, 'location', 'location');
Sweet!
Andrew