本文整理汇总了PHP中core\event\user_created::get_record_snapshot方法的典型用法代码示例。如果您正苦于以下问题:PHP user_created::get_record_snapshot方法的具体用法?PHP user_created::get_record_snapshot怎么用?PHP user_created::get_record_snapshot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core\event\user_created
的用法示例。
在下文中一共展示了user_created::get_record_snapshot方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create_player
public static function create_player(\core\event\user_created $event)
{
$pl = block_playlyfe_sdk::get_pl();
$user = $event->get_record_snapshot('user', $event->objectid);
$pl->post('/admin/players', array(), array('id' => $user->id, 'alias' => $user->firstname . ' ' . $user->lastname));
}
示例2: user_created
public static function user_created(\core\event\user_created $event)
{
global $CFG, $DB;
$sync_to_joomla = get_config('auth/joomdle', 'sync_to_joomla');
if (!$sync_to_joomla) {
return true;
}
$user = $event->get_record_snapshot('user', $event->objectid);
if ($user->auth != 'joomdle') {
return true;
}
$auth_joomdle = new auth_plugin_joomdle();
/*
$password_clear = '';
if (array_key_exists ('password', $_POST))
$password_clear = $_POST['password']; //Self registration
if ((array_key_exists ('newpassword', $_POST)) && (!$password_clear))
$password_clear = $_POST['newpassword']; //admin form
*/
/* Create user in Joomla */
$userinfo['username'] = $user->username;
/*
$userinfo['password'] = $password_clear;
$userinfo['password2'] = $password_clear;
*/
$userinfo['password'] = $user->password;
$userinfo['password2'] = $user->password;
$userinfo['name'] = $user->firstname . " " . $user->lastname;
$userinfo['email'] = $user->email;
$userinfo['firstname'] = $user->firstname;
$userinfo['lastname'] = $user->lastname;
$userinfo['city'] = $user->city;
$userinfo['country'] = $user->country;
$userinfo['lang'] = $user->lang;
$userinfo['timezone'] = $user->timezone;
$userinfo['phone1'] = $user->phone1;
$userinfo['phone2'] = $user->phone2;
$userinfo['address'] = $user->address;
$userinfo['description'] = $user->description;
$userinfo['institution'] = $user->institution;
$userinfo['url'] = $user->url;
$userinfo['icq'] = $user->icq;
$userinfo['skype'] = $user->skype;
$userinfo['aim'] = $user->aim;
$userinfo['yahoo'] = $user->yahoo;
$userinfo['msn'] = $user->msn;
$userinfo['idnumber'] = $user->idnumber;
$userinfo['department'] = $user->department;
$userinfo['picture'] = $user->picture;
$userinfo['lastnamephonetic'] = $user->lastnamephonetic;
$userinfo['firstnamephonetic'] = $user->firstnamephonetic;
$userinfo['middlename'] = $user->middlename;
$userinfo['alternatename'] = $user->alternatename;
$id = $user->id;
$usercontext = context_user::instance($id);
$context_id = $usercontext->id;
if ($user->picture) {
$userinfo['pic_url'] = $CFG->wwwroot . "/pluginfile.php/{$context_id}/user/icon/f1";
}
$userinfo['block'] = 0;
/* Custom fields */
$query = "SELECT f.id, d.data \n FROM {$CFG->prefix}user_info_field as f, {$CFG->prefix}user_info_data d \n WHERE f.id=d.fieldid and userid = ?";
$params = array($id);
$records = $DB->get_records_sql($query, $params);
$i = 0;
$userinfo['custom_fields'] = array();
foreach ($records as $field) {
$userinfo['custom_fields'][$i]['id'] = $field->id;
$userinfo['custom_fields'][$i]['data'] = $field->data;
$i++;
}
$auth_joomdle->call_method("createUser", $userinfo);
return true;
}