diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index 6ea253e25..571a9d6ca 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -1893,6 +1893,11 @@ class e_form $current_value = e107::getUserClass()->getClassFromKey($tmp[0]); } + if(!empty($current_value) && !is_numeric($current_value)) // convert name to id. + { + $current_value = $this->_uc->getID($current_value); + } + return $this->select_open($name, $select_options)."\n".$this->_uc->vetted_tree($name, array($this, '_uc_select_cb'), $current_value, $uc_options, $opt_options)."\n".$this->select_close(); } diff --git a/e107_handlers/userclass_class.php b/e107_handlers/userclass_class.php index b7d6d60ac..d462abb09 100644 --- a/e107_handlers/userclass_class.php +++ b/e107_handlers/userclass_class.php @@ -969,12 +969,14 @@ class user_class + + /** * Look up class ID for a given class name * @param string $name - class name * @return integer|boolean FALSE if not found, else user class ID */ - public function ucGetClassIDFromName($name) + public function getID($name) { $this->readTree(); // We have all the info - can just search the array @@ -990,6 +992,19 @@ class user_class + + + /** + * BC Alias of getID(); + * @param $name + * @return mixed + */ + public function ucGetClassIDFromName($name) + { + return $this->getId($name); + + } + /** * Utility to remove a specified class ID from the default comma-separated list * Optional conversion to array of classes