本文整理汇总了PHP中eZUserSetting::create方法的典型用法代码示例。如果您正苦于以下问题:PHP eZUserSetting::create方法的具体用法?PHP eZUserSetting::create怎么用?PHP eZUserSetting::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZUserSetting
的用法示例。
在下文中一共展示了eZUserSetting::create方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: storeObjectAttribute
function storeObjectAttribute($contentObjectAttribute)
{
$user = $contentObjectAttribute->content();
if (!$user instanceof eZUser) {
// create a default user account
$user = eZUser::create($contentObjectAttribute->attribute("contentobject_id"));
$userID = $contentObjectAttribute->attribute("contentobject_id");
$isEnabled = 1;
$userSetting = eZUserSetting::create($userID, $isEnabled);
$userSetting->store();
}
$user->store();
$contentObjectAttribute->setContent($user);
}
示例2: storeObjectAttribute
function storeObjectAttribute($contentObjectAttribute)
{
/** @var eZContentObjectAttribute $contentObjectAttribute */
/** @var eZUser $user */
$user = $contentObjectAttribute->content();
if (!$user instanceof eZUser) {
// create a default user account
$user = eZUser::create($contentObjectAttribute->attribute("contentobject_id"));
$userID = $contentObjectAttribute->attribute("contentobject_id");
$isEnabled = 1;
$userSetting = eZUserSetting::create($userID, $isEnabled);
$userSetting->store();
$user->store();
$contentObjectAttribute->setContent($user);
} else {
// No "draft" for version 1 to avoid regression for existing code creating new users.
if ($contentObjectAttribute->attribute('version') == '1') {
$user->store();
$contentObjectAttribute->setContent($user);
}
// saving information in the object attribute data_text field to simulate a draft
$contentObjectAttribute->setAttribute('data_text', $this->serializeDraft($user));
}
}