本文整理汇总了PHP中UserService::create方法的典型用法代码示例。如果您正苦于以下问题:PHP UserService::create方法的具体用法?PHP UserService::create怎么用?PHP UserService::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserService
的用法示例。
在下文中一共展示了UserService::create方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doCreateSubmit
public function doCreateSubmit()
{
$userService = new UserService();
$userVo = Request::getValue("user", "UserValue");
if ($userVo->password != '') {
$userVo->password = MD5($userVo->password);
}
//var_dump($userVo);exit;
if (!$userVo->checkOptions($userVo->getCreateOptions())) {
View::set("UserCreateValue", $userVo);
View::display("Create");
return;
}
$userVo = $userService->create($userVo);
Zee::redirect(Zee::url("user", "list"));
}
示例2: add_user
private function add_user()
{
if (PersistenceContext::get_querier()->row_exists(DB_TABLE_INTERNAL_AUTHENTICATION, 'WHERE login=:login', array('login' => $this->login))) {
throw new Exception($this->login . ' login already use');
} else {
if (UserService::user_exists('WHERE email=:email', array('email' => $this->email))) {
throw new Exception($this->email . ' email already use');
} else {
$user = new User();
$user->set_display_name($this->login);
$user->set_level($this->get_real_value($this->level, $this->level_possible_values));
$user->set_email($this->email);
$auth_method = new PHPBoostAuthenticationMethod($this->login, $this->password);
$auth_method->set_association_parameters($this->get_real_value($this->approbation, $this->approbation_possible_values));
UserService::create($user, $auth_method);
CLIOutput::writeln('User added successfull');
}
}
}
示例3: save
private function save()
{
$has_error = false;
$registration_pass = $this->user_accounts_config->get_member_accounts_validation_method() == UserAccountsConfig::MAIL_USER_ACCOUNTS_VALIDATION ? KeyGenerator::generate_key(15) : '';
$user_aprobation = $this->user_accounts_config->get_member_accounts_validation_method() == UserAccountsConfig::AUTOMATIC_USER_ACCOUNTS_VALIDATION;
$user = new User();
$user->set_display_name($this->form->get_value('display_name'));
$user->set_level(User::MEMBER_LEVEL);
$user->set_email($this->form->get_value('email'));
$user->set_show_email(!$this->form->get_value('user_hide_mail'));
$user->set_locale($this->form->get_value('lang')->get_raw_value());
$user->set_editor($this->form->get_value('text-editor')->get_raw_value());
$user->set_timezone($this->form->get_value('timezone')->get_raw_value());
if ($this->form->has_field('theme')) {
$user->set_theme($this->form->get_value('theme')->get_raw_value());
}
$login = $this->form->get_value('email');
if ($this->form->get_value('custom_login')) {
$login = $this->form->get_value('login');
}
$auth_method = new PHPBoostAuthenticationMethod($login, $this->form->get_value('password'));
$auth_method->set_association_parameters($user_aprobation, $registration_pass);
try {
$user_id = UserService::create($user, $auth_method, $this->member_extended_fields_service);
} catch (MemberExtendedFieldErrorsMessageException $e) {
$has_error = true;
$this->tpl->put('MSG', MessageHelper::display($e->getMessage(), MessageHelper::NOTICE));
}
if (!$has_error) {
UserRegistrationService::send_email_confirmation($user_id, $user->get_email(), $this->form->get_value('display_name'), $login, $this->form->get_value('password'), $registration_pass);
$this->confirm_registration($user_id);
}
}
示例4: create_first_admin_account
private function create_first_admin_account($login, $password, $email, $locale, $theme, $timezone)
{
$user = new User();
$user->set_display_name($login);
$user->set_level(User::ADMIN_LEVEL);
$user->set_email($email);
$user->set_locale($locale);
$user->set_theme($theme);
$auth_method = new PHPBoostAuthenticationMethod($login, $password);
return UserService::create($user, $auth_method);
}
示例5: authenticate
/**
* {@inheritDoc}
*/
public function authenticate()
{
$data = $this->get_google_user_data();
$google_id = $data['id'];
try {
$condition = 'WHERE method=:method AND identifier=:identifier';
$parameters = array('method' => self::AUTHENTICATION_METHOD, 'identifier' => $google_id);
return $this->querier->get_column_value(DB_TABLE_AUTHENTICATION_METHOD, 'user_id', $condition, $parameters);
} catch (RowNotFoundException $e) {
$email_exists = $this->querier->row_exists(DB_TABLE_MEMBER, 'WHERE email=:email', array('email' => $data['email']));
if ($email_exists) {
$this->error_msg = LangLoader::get_message('external-auth.account-exists', 'user-common');
} else {
$user = new User();
$user->set_display_name(utf8_decode($data['name']));
$user->set_level(User::MEMBER_LEVEL);
$user->set_email($data['email']);
$auth_method = new GoogleAuthenticationMethod();
$fields_data = array('user_avatar' => $data['picture']);
return UserService::create($user, $auth_method, $fields_data);
}
}
}
示例6: testUserService
/**
* @expectedException PHPUnit_Framework_AssertionFailedError
*/
public function testUserService()
{
$service = new UserService();
$service->create(['name' => 'davert']);
}
示例7: save
private function save()
{
$user = new User();
$user->set_display_name($this->form->get_value('display_name'));
$user->set_level($this->form->get_value('rank')->get_raw_value());
$user->set_email($this->form->get_value('email'));
$login = $this->form->get_value('email');
if ($this->form->get_value('custom_login', false)) {
$login = $this->form->get_value('login');
}
$auth_method = new PHPBoostAuthenticationMethod($login, $this->form->get_value('password'));
UserService::create($user, $auth_method);
return $user->get_display_name();
}