本文整理汇总了PHP中User_Model::random_username方法的典型用法代码示例。如果您正苦于以下问题:PHP User_Model::random_username方法的具体用法?PHP User_Model::random_username怎么用?PHP User_Model::random_username使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类User_Model
的用法示例。
在下文中一共展示了User_Model::random_username方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create_user
/**
* Creates a basic user and assigns to login and member roles
*
* @param string email
* @param string password
* @param string riverid user id
* @return object ORM object from saving the user
*/
public static function create_user($email, $password, $riverid = FALSE, $name = FALSE)
{
$user = ORM::factory('user');
$user->email = $email;
$user->username = User_Model::random_username();
$user->password = $password;
if (!empty($name)) {
$user->name = $name;
} else {
$user->needinfo = 1;
}
$user->riverid = $riverid == false ? '' : $riverid;
// Add New Roles if:
// 1. We don't require admin to approve users (will be added when admin approves)
// 2. We don't require users to first confirm their email address (will be added
// when user confirms if the admin doesn't have to first approve the user)
if (Kohana::config('settings.manually_approve_users') == 0 and Kohana::config('settings.require_email_confirmation') == 0) {
$user->add(ORM::factory('role', 'login'));
$user->add(ORM::factory('role', 'member'));
}
return $user->save();
}