Index: branches/RC/core/units/users/users_event_handler.php =================================================================== diff -u -r9175 -r9416 --- branches/RC/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 9175) +++ branches/RC/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 9416) @@ -1327,6 +1327,25 @@ $this->Application->EmailEventAdmin($email_event); } } + + /** + * OnAfterConfigRead for users + * + * @param kEvent $event + */ + function OnAfterConfigRead(&$event) + { + parent::OnAfterConfigRead($event); + + // update Country SQL + $fields = $this->Application->getUnitOption($event->Prefix, 'Fields'); + $first_country = $this->Application->ConfigValue('User_Default_Registration_Country'); + + if ($first_country) { + $fields['Country']['options_sql'] = preg_replace('/ORDER BY (.*)/', 'ORDER BY IF (DestId = '.$first_country.', 1, 0) DESC, \\1', $fields['Country']['options_sql']); + $this->Application->setUnitOption($event->Prefix, 'Fields', $fields); + } + } } ?> \ No newline at end of file