/** * Create a new user. * * @param string $userid The new userid. * @param string $password The new plain text password. * @param string $email The new users email. * @param string $coach 't' if the user is a coach. * @param string $athlete 't' if the user is an athlete. * @param string $superuser 't' if the user is a superuser. * * @return null */ function createUser($userid, $password, $email, $coach = 'f', $athlete = 't', $superuser = '******') { $password_salt = Core_Common::getRandomString(64); $password_hash = sha1($password . $password_salt); $db = Zend_Registry::get('db'); $auth = Zend_Registry::get('auth'); $auth_token = $auth->getHashTokenAuth($userid, $password_hash); if (!Core_Access::isSuperUser()) { $superuser = '******'; } $db->insert('t_users', array('userid' => $userid, 'password_hash' => $password_hash, 'password_salt' => $password_salt, 'email' => $email, 'coach' => $coach, 'athlete' => $athlete, 'superuser' => $superuser, 'token' => $auth_token)); }