本文整理汇总了PHP中MEMBER::create方法的典型用法代码示例。如果您正苦于以下问题:PHP MEMBER::create方法的具体用法?PHP MEMBER::create怎么用?PHP MEMBER::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MEMBER
的用法示例。
在下文中一共展示了MEMBER::create方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_memberadd
/**
* @todo document this
*/
function action_memberadd()
{
global $member, $manager;
// check if allowed
$member->isAdmin() or $this->disallow();
if (postVar('password') != postVar('repeatpassword')) {
$this->error(_ERROR_PASSWORDMISMATCH);
}
if (strlen(postVar('password')) < 6) {
$this->error(_ERROR_PASSWORDTOOSHORT);
}
$res = MEMBER::create(postVar('name'), postVar('realname'), postVar('password'), postVar('email'), postVar('url'), postVar('admin'), postVar('canlogin'), postVar('notes'));
if ($res != 1) {
$this->error($res);
}
// fire PostRegister event
$newmem = new MEMBER();
$newmem->readFromName(postVar('name'));
$manager->notify('PostRegister', array('member' => &$newmem));
$this->action_usermanagement();
}
示例2: createAccount
/**
* Creates a new user account
*/
function createAccount()
{
global $CONF, $manager;
if (!$CONF['AllowMemberCreate']) {
doError(_ERROR_MEMBERCREATEDISABLED);
}
// evaluate content from FormExtra
$result = 1;
$data = array('type' => 'membermail', 'error' => &$result);
$manager->notify('ValidateForm', &$data);
if ($result != 1) {
return $result;
} else {
// even though the member can not log in, set some random initial password. One never knows.
srand((double) microtime() * 1000000);
$initialPwd = md5(uniqid(rand(), TRUE));
// create member (non admin/can not login/no notes/random string as password)
$name = shorten(postVar('name'), 32, '');
$r = MEMBER::create($name, postVar('realname'), $initialPwd, postVar('email'), postVar('url'), 0, 0, '');
if ($r != 1) {
return $r;
}
// send message containing password.
$newmem = new MEMBER();
$newmem->readFromName($name);
$newmem->sendActivationLink('register');
$manager->notify('PostRegister', array('member' => &$newmem));
if (postVar('desturl')) {
redirect(postVar('desturl'));
} else {
// header has been already sent, so deleted the line below
sendContentType('text/html', '', _CHARSET);
echo _MSG_ACTIVATION_SENT;
echo '<br /><br />Return to <a href="' . $CONF['IndexURL'] . '" title="' . $CONF['SiteName'] . '">' . $CONF['SiteName'] . '</a>';
echo "\n</body>\n</html>";
}
exit;
}
}