本文整理匯總了PHP中ImpExData::import_user方法的典型用法代碼示例。如果您正苦於以下問題:PHP ImpExData::import_user方法的具體用法?PHP ImpExData::import_user怎麽用?PHP ImpExData::import_user使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ImpExData
的用法示例。
在下文中一共展示了ImpExData::import_user方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: isset
function parse_user($data)
{
$attributes =& $data['attributes'];
if (empty($attributes['unique'])) {
//echo "user tag without data we need!<br />\n"; flush();
return;
}
$deleted = isset($attributes['deleted']) ? '; deleted!' : '';
$user_object = new ImpExData($this->Db_object, $this->session, 'user');
$user_object->set_value('mandatory', 'usergroupid', $this->session->get_session_var('usergroupid'));
// Swap hutch, jerry for jerry hutch
if (substr(', ', $attributes['name'])) {
$name_bits = explode(' ', $attributes['name']);
$attributes['name'] = $name_bits[1] . ' ' . substr($name_bits[0], 0, -1);
}
$user_object->set_value('mandatory', 'username', trim($attributes['name']));
$user_object->set_value('mandatory', 'email', $attributes['email']);
$user_object->set_value('mandatory', 'importuserid', hexdec($attributes['ID']));
// passwords are stored as binary md5 hashes. Need to take each nibble from each byte
// and convert it to hex
if (strlen($attributes['password']) == 16) {
$password = '';
for ($i = 0; $i < 16; $i++) {
$chr = ord($attributes['password'][$i]);
$password .= dechex($chr >> 4 & 0xf);
$password .= dechex($chr & 0xf);
}
} else {
// hey, this wouldn't even going to come out to a valid md5 hash...
$password = $attributes['password'];
}
$user_object->_password_md5_already = true;
$user_object->set_value('nonmandatory', 'password', $password);
$user_object->set_value('nonmandatory', 'passworddate', time());
$user_object->set_value('nonmandatory', 'homepage', $attributes['homePage']);
$user_object->set_value('nonmandatory', 'joindate', @strtotime($attributes['registeredTd']));
$user_object->set_value('nonmandatory', 'lastvisit', @strtotime($attributes['lastLogin']));
$user_object->set_value('nonmandatory', 'lastactivity', @strtotime($attributes['lastLogin']));
$user_object->set_value('nonmandatory', 'options', $this->_default_user_permissions);
if ($user_object->import_user($this->Db_object, $this->target_db_type, $this->target_db_prefix)) {
echo "<br /><span class=\"isucc\"><b>" . $user_object->how_complete() . "%</b></span> users -> :: " . $user_object->get_value('mandatory', 'username');
flush();
} else {
echo "<h1>'" . trim($attributes['name']) . " not imported" . "'</h1>";
}
#echo "found user '$attributes[name]' ($attributes[unique]$deleted)<br />\n"; flush();
}