$user = $this->modx->getObject('modUser', $uid);
if ($user) {
$extended = $profile->get('extended');
if ($extended) {
$u_field = $extended['user_field'];
}
}
$username = 'username';
$query = $modx->newQuery('modUser', array(
'username' => $username,
));
$query->select('id');
$userId = $modx->getValue($query->prepare());