本文整理汇总了PHP中Model_User::createUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_User::createUser方法的具体用法?PHP Model_User::createUser怎么用?PHP Model_User::createUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model_User
的用法示例。
在下文中一共展示了Model_User::createUser方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createWechatAccount
/**
* 根据微信推送的包,创建相关帐户信息
*
* @param $openid 微信服务器推送的微信粉丝OpenId
* @param $account 接受微信服务器推送数据的公众号实体对象
* @return 创建成功返回微信OpenId数据对象,否则返回False
*/
public static function createWechatAccount($openid, $account = [])
{
//创建微信信息
$wechat = \Model_Wechat::forge(['nickname' => $openid]);
//是否创建用户登录信息
if (isset($account->is_subscribe_create_user) && $account->is_subscribe_create_user) {
$params = ['username' => "wx_{$openid}", 'password' => "w{$account->id}#{$openid}", 'email' => "wx_{$openid}@{$account->id}.com", 'group_id' => $account->create_user_default_group];
$user_id = \Model_User::createUser($params);
$wechat->user_id = $user_id;
$params = ['user_id' => $user_id];
$people = \Model_People::forge($params);
$people->save();
//是否创建会员信息
if (isset($account->is_subscribe_create_member) && $account->is_subscribe_create_member) {
$params = ['no' => "{$account->seller_id}{$wechat->user_id}" . time(), 'user_id' => $wechat->user_id];
$member = \Model_Member::forge($params);
$member->save();
}
}
//创建微信OpenID记录
$params = ['openid' => $openid, 'account_id' => $account->id];
$wechatOpenid = \Model_WechatOpenid::forge($params);
$wechat->ids = [$wechatOpenid];
$wechat->save();
return $wechatOpenid;
}
示例2: createAction
public function createAction()
{
$frmUser = new Form_User();
if ($this->_request->isPost()) {
if ($frmUser->isValid($_POST)) {
$mdlUser = new Model_User();
$mdlUser->createUser($frmUser->getValue('username'), $frmUser->getValue('password'), $frmUser->getValue('first_name'), $frmUser->getValue('last_name'), $frmUser->getValue('role'));
return $this->_forward('list');
}
}
$frmUser->setAction('/user/create');
$this->view->form = $frmUser;
}
示例3: indexAction
public function indexAction()
{
$sessionId = $_REQUEST["sessionId"];
$no = $_REQUEST["phoneNumber"];
$no = str_replace("+", "", $no);
$no2 = substr($no, -9);
if (!empty($_REQUEST['text'])) {
$message = $_REQUEST["text"];
$result = explode("*", $message);
if (empty($result)) {
$message = $message;
} else {
end($result);
// move the internal pointer to the end of the array
$message = current($result);
}
} else {
$message = 'start';
}
$data = array('content' => $message);
//$tablee = "ussd";
$userModel = new Model_User();
$user = $userModel->getUserWithPhone($no);
// print_r($user);
// exit;
if ($user['id'] == 0) {
$user = $userModel->getUserWithPhone($no2);
if ($user['id'] == 0) {
//register user
$dataa = array('phoneno' => $no, 'menu_item_id' => 1);
$result = $userModel->createUser($dataa);
$user = $userModel->getUserWithPhone($no);
if ($result) {
$output = $this->mainMenu($user, $no);
$response = "CON ";
$response .= $output;
echo $response;
exit;
//print_r($output);
//exit;
}
} else {
if ($user->role == 102) {
$this->agrovet($user, $message, $sessionId);
}
}
} else {
$this->main($user, $message, $sessionId);
exit;
}
}
示例4: createUser
/**
* Creates a new user
*
* @param string $userName User name to create User for
* @param string $firstName User's first name
* @param string $lastName User's last name
* @param string $email User's email address
* @param string $password User's password
* @param string $active User's activity status
* @param string $role User's acl role
* @return mixed False if unsuccessful, otherwise Model_User object
*/
public function createUser($userName, $firstName, $lastName, $email, $password, $active = 0, $role = Model_Group::GUEST_ROLE)
{
$mdlUser = new Model_User();
$userName = $mdlUser->createUser($userName, $firstName, $lastName, $email, $password, $active, $role);
if (!empty($userName) && '' != $userName) {
return $this->prepareChallenge($userName, $email);
}
return false;
}
示例5: createEnterpriseTransaction
public function createEnterpriseTransaction($ficha)
{
$AddressEnterprise = new Model_AddressEnterprise();
$AddressPresident = new Model_AddressPresident();
$President = new Model_President();
$PresidentProgram = new Model_PresidentProgram();
$User = new Model_User();
$UserLocality = new Model_UserLocality();
$Acl = new Model_Acl();
$modelEntCatAwardCompetition = new Model_EnterpriseCategoryAwardCompetition();
$modelLogCadastroEmpresa = new Model_LogCadastroEmpresa();
//$Eligibility = new Model_Eligibility();
// dados da Empresa
$registerEnterpriseData = $ficha['enterprise'];
$registerEnterpriseData['status'] = 'A';
// dados endereço da Empresa
$registerAddressEnterpriseData = $ficha['addressEnterprise'];
// dados da presidente da Empresa
$registerPresidentData = $ficha['president'];
$registerPresidentData['gender'] = 'F';
$registerPresidentData['created'] = date('Y-m-d');
$registerPresidentData['hasnt_email'] = isset($ficha['enterprise']['hasnt_email']) ? $ficha['enterprise']['hasnt_email'] : 0;
// dados endereço da Empresa
$registerAddressPresidentData = $ficha['addressPresident'];
// dados do program do presidente da Empresa
$registerPresidentProgramData = isset($ficha['presidentProgram']) ? $ficha['presidentProgram'] : null;
// dados do usuário
$registerUserData = $ficha['user'];
$registerUserData['login'] = $registerPresidentData['cpf'];
$registerUserData['first_name'] = $registerPresidentData['name'];
$registerUserData['surname'] = isset($registerPresidentData['nick_name']) ? $registerPresidentData['nick_name'] : null;
$registerUserData['email'] = $registerPresidentData['email'];
$registerUserData['status'] = 'A';
$registerLogCadastro = isset($ficha['log_cadastro_empresa']) ? $ficha['log_cadastro_empresa'] : false;
// start transaction externo
Zend_Registry::get('db')->beginTransaction();
try {
$enterpriseEmail = isset($ficha['enterprise']['email_default']) ? $ficha['enterprise']['email_default'] : '';
$hasntEmail = isset($ficha['enterprise']['hasnt_email']) ? $ficha['enterprise']['hasnt_email'] : 0;
$this->validateEmail(NULL, $enterpriseEmail, $hasntEmail);
$this->validateLandline($ficha['enterprise']['phone']);
// Validação Categoria do Premio
$insertCategoryAward = $this->validCategoryAward($registerEnterpriseData);
if (!$insertCategoryAward['status']) {
throw new Vtx_UserException($insertCategoryAward['messageError'], 10);
}
// 1.1 Insert Empresa
$insertEnterprise = $this->createEnterprise($registerEnterpriseData);
if (!$insertEnterprise['status']) {
throw new Vtx_UserException($insertEnterprise['messageError'], 10);
}
// elegibilidade para questionario de diagnostico
//$Eligibility->doDiagnosticoEligibility($insertEnterprise['row']);
// 1.2 Insert Endereço da Empresa
$registerAddressEnterpriseData['enterprise_id'] = $insertEnterprise['lastInsertId'];
$insertAddressEnterprise = $AddressEnterprise->createAddressEnterprise($registerAddressEnterpriseData);
if (!$insertAddressEnterprise['status']) {
throw new Vtx_UserException($insertAddressEnterprise['messageError'], 10);
}
// validação dos campos NewsLetter da Candidata (President)
$newsLetterValid = $President->isValidNewsletter($ficha['newsletter'], $registerPresidentData);
if (!$newsLetterValid['status']) {
throw new Vtx_UserException($newsLetterValid['messageError']);
}
// 2.1 Insert Presidente da Empresa
$registerPresidentData['enterprise_id'] = $insertEnterprise['lastInsertId'];
$insertPresident = $President->createPresident($registerPresidentData);
if (!$insertPresident['status']) {
throw new Vtx_UserException($insertPresident['messageError']);
}
$registerECAC = array();
$registerECAC['enterprise_id'] = $insertEnterprise['lastInsertId'];
$registerECAC['competition_id'] = Zend_Registry::get('configDb')->competitionId;
$registerECAC['category_award_id'] = $registerEnterpriseData['category_award_id'];
$insertECAC = $modelEntCatAwardCompetition->createECAC($registerECAC);
if (!$insertECAC['status']) {
throw new Vtx_UserException($insertECAC['messageError']);
}
// 2.2 Insert Endereço da Presidente
$registerAddressPresidentData['president_id'] = $insertPresident['lastInsertId'];
$insertAddressPresident = $AddressPresident->createAddressPresident($registerAddressPresidentData);
if (!$insertAddressPresident['status']) {
throw new Vtx_UserException($insertAddressPresident['messageError']);
}
// 2.3 Programa do Presidente da Empresa
if ($registerPresidentProgramData) {
$presidentId = $insertPresident['lastInsertId'];
$createPresidentProgram = $PresidentProgram->createPresidentProgramByPresidentId($registerPresidentProgramData, $presidentId);
if (!$createPresidentProgram['status']) {
throw new Vtx_UserException($createPresidentProgram['messageError']);
}
}
// 3.1 Insert Responsável pelo preenchimento - usuário do sistema
if (isset($registerUserData['set_login_cpf']) and $registerUserData['set_login_cpf'] == '1') {
$registerUserData['login'] = $registerUserData['cpf'];
}
$insertUser = $User->createUser($registerUserData);
if (!$insertUser['status']) {
throw new Vtx_UserException($insertUser['messageError']);
}
//.........这里部分代码省略.........