本文整理汇总了PHP中thebuggenie\core\entities\User::setActivated方法的典型用法代码示例。如果您正苦于以下问题:PHP User::setActivated方法的具体用法?PHP User::setActivated怎么用?PHP User::setActivated使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类thebuggenie\core\entities\User
的用法示例。
在下文中一共展示了User::setActivated方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadFixtures
/**
* Load user fixtures for a specified scope
*
* @param Scope $scope
* @param Group $admin_group
* @param Group $user_group
* @param Group $guest_group
*/
public static function loadFixtures(Scope $scope, Group $admin_group, Group $user_group, Group $guest_group)
{
$adminuser = new User();
$adminuser->setUsername('administrator');
$adminuser->setRealname('Administrator');
$adminuser->setBuddyname('Admin');
$adminuser->setGroup($admin_group);
$adminuser->setPassword('admin');
$adminuser->setActivated();
$adminuser->setEnabled();
$adminuser->setAvatar('admin');
$adminuser->save();
$guestuser = new User();
$guestuser->setUsername('guest');
$guestuser->setRealname('Guest user');
$guestuser->setBuddyname('Guest user');
$guestuser->setGroup($guest_group);
$guestuser->setPassword('password');
// Settings not active yet
$guestuser->setActivated();
$guestuser->setEnabled();
$guestuser->save();
framework\Settings::saveSetting('defaultuserid', $guestuser->getID(), 'core', $scope->getID());
return array($guestuser->getID(), $adminuser->getID());
}
示例2: getOrCreateUserFromEmailString
public function getOrCreateUserFromEmailString($email_string)
{
$email = $this->getEmailAdressFromSenderString($email_string);
if (!($user = User::findUser($email))) {
$name = $email;
if (($q_pos = strpos($email_string, "<")) !== false) {
$name = trim(substr($email_string, 0, $q_pos - 1));
}
$user = new User();
try {
$user->setBuddyname($name);
$user->setEmail($email);
$user->setUsername($email);
$user->setValidated();
$user->setActivated();
$user->setEnabled();
$user->save();
} catch (\Exception $e) {
return null;
}
}
return $user;
}
示例3: runIndex
/**
* Configuration import page
*
* @param framework\Request $request
*/
public function runIndex(framework\Request $request)
{
if ($request->isPost()) {
if ($request['import_sample_data']) {
$transaction = \b2db\Core::startTransaction();
$users = array();
$user1 = new entities\User();
$user1->setUsername('john');
$user1->setPassword('john');
$user1->setBuddyname('John');
$user1->setRealname('John');
$user1->setActivated();
$user1->setEnabled();
$user1->save();
$users[] = $user1;
$user2 = new entities\User();
$user2->setUsername('jane');
$user2->setPassword('jane');
$user2->setBuddyname('Jane');
$user2->setRealname('Jane');
$user2->setActivated();
$user2->setEnabled();
$user2->save();
$users[] = $user2;
$user3 = new entities\User();
$user3->setUsername('jackdaniels');
$user3->setPassword('jackdaniels');
$user3->setBuddyname('Jack');
$user3->setRealname('Jack Daniels');
$user3->setActivated();
$user3->setEnabled();
$user3->save();
$users[] = $user3;
$project1 = new entities\Project();
$project1->setName('Sample project 1');
$project1->setOwner($users[rand(0, 2)]);
$project1->setLeader($users[rand(0, 2)]);
$project1->setQaResponsible($users[rand(0, 2)]);
$project1->setDescription('This is a sample project that is awesome. Try it out!');
$project1->setHomepage('http://www.google.com');
$project1->save();
$project2 = new entities\Project();
$project2->setName('Sample project 2');
$project2->setOwner($users[rand(0, 2)]);
$project2->setLeader($users[rand(0, 2)]);
$project2->setQaResponsible($users[rand(0, 2)]);
$project2->setDescription('This is the second sample project. Not as awesome as the first one, but still worth a try!');
$project2->setHomepage('http://www.bing.com');
$project2->save();
foreach (array($project1, $project2) as $project) {
for ($cc = 1; $cc <= 5; $cc++) {
$milestone = new entities\Milestone();
$milestone->setName("Milestone {$cc}");
$milestone->setProject($project);
$milestone->setType(entities\Milestone::TYPE_REGULAR);
if ((bool) rand(0, 1)) {
$milestone->setScheduledDate(NOW + 100000 * (20 * $cc));
}
$milestone->save();
}
}
$p1_milestones = $project1->getMilestones();
$p2_milestones = $project2->getMilestones();
$issues = array();
$priorities = entities\Priority::getAll();
$categories = entities\Category::getAll();
$severities = entities\Severity::getAll();
$statuses = entities\Status::getAll();
$reproducabilities = entities\Reproducability::getAll();
$lorem_ipsum = \thebuggenie\modules\publish\entities\tables\Articles::getTable()->getArticleByName('LoremIpsum');
$lorem_words = explode(' ', $lorem_ipsum->getContent());
foreach (array('bugreport', 'featurerequest', 'enhancement', 'idea') as $issuetype) {
$issuetype = entities\Issuetype::getByKeyish($issuetype);
for ($cc = 1; $cc <= 10; $cc++) {
$issue1 = new entities\Issue();
$issue1->setProject($project1);
$issue1->setPostedBy($users[rand(0, 2)]);
$issue1->setPosted(NOW - 86400 * rand(1, 30));
$title_string = '';
$description_string = '';
$rand_length = rand(4, 15);
$ucnext = true;
for ($ll = 1; $ll <= $rand_length; $ll++) {
$word = str_replace(array(',', '.', "\r", "\n"), array('', '', '', ''), $lorem_words[array_rand($lorem_words)]);
$word = $ucnext || rand(1, 40) == 19 ? ucfirst($word) : mb_strtolower($word);
$title_string .= $word;
$ucnext = false;
if ($ll == $rand_length || rand(1, 15) == 5) {
$title_string .= '.';
$ucnext = true;
}
$title_string .= ' ';
}
$rand_length = rand(40, 500);
$ucnext = true;
//.........这里部分代码省略.........