本文整理汇总了PHP中core\event\user_updated::get_record_snapshot方法的典型用法代码示例。如果您正苦于以下问题:PHP user_updated::get_record_snapshot方法的具体用法?PHP user_updated::get_record_snapshot怎么用?PHP user_updated::get_record_snapshot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core\event\user_updated
的用法示例。
在下文中一共展示了user_updated::get_record_snapshot方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: user_updated
public static function user_updated(\core\event\user_updated $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();
/* Update user info in Joomla */
$userinfo['username'] = $user->username;
$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\t\t\t\t\tFROM {$CFG->prefix}user_info_field as f, {$CFG->prefix}user_info_data d \n\t\t\t\t\tWHERE 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("updateUser", $userinfo);
return true;
}