本文整理汇总了PHP中UserAttributeKey::getEditableInProfileList方法的典型用法代码示例。如果您正苦于以下问题:PHP UserAttributeKey::getEditableInProfileList方法的具体用法?PHP UserAttributeKey::getEditableInProfileList怎么用?PHP UserAttributeKey::getEditableInProfileList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserAttributeKey
的用法示例。
在下文中一共展示了UserAttributeKey::getEditableInProfileList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: t
}
}
?>
<h1 class="profilin"><?php
echo t('Edit Profile');
?>
</h1>
<div class="ccm-form">
<form method="post" action="<?php
echo $this->action('save');
?>
" id="profile-edit-form" enctype="multipart/form-data">
<?php
$attribs = UserAttributeKey::getEditableInProfileList();
if (is_array($attribs) && count($attribs)) {
?>
<fieldset>
<div class="ccm-profile-attribute">
<?php
echo $form->label('uEmail', t('Email'));
?>
<span class="ccm-required">*</span><br/>
<?php
echo $form->text('uEmail', $ui->getUserEmail());
?>
</div>
<?php
if (ENABLE_USER_TIMEZONES) {
?>
示例2: save
public function save() {
$ui = $this->get('ui');
$uh = Loader::helper('concrete/user');
$th = Loader::helper('text');
$vsh = Loader::helper('validation/strings');
$cvh = Loader::helper('concrete/validation');
$e = Loader::helper('validation/error');
$data = $this->post();
/*
* Validation
*/
// validate the user's email
$email = $this->post('uEmail');
if (!$vsh->email($email)) {
$e->add(t('Invalid email address provided.'));
} else if (!$cvh->isUniqueEmail($email) && $ui->getUserEmail() != $email) {
$e->add(t("The email address '%s' is already in use. Please choose another.",$email));
}
// password
if(strlen($data['uPasswordNew'])) {
$passwordNew = $data['uPasswordNew'];
$passwordNewConfirm = $data['uPasswordNewConfirm'];
if ((strlen($passwordNew) < USER_PASSWORD_MINIMUM) || (strlen($passwordNew) > USER_PASSWORD_MAXIMUM)) {
$e->add(t('A password must be between %s and %s characters', USER_PASSWORD_MINIMUM, USER_PASSWORD_MAXIMUM));
}
if (strlen($passwordNew) >= USER_PASSWORD_MINIMUM && !$cvh->password($passwordNew)) {
$e->add(t('A password may not contain ", \', >, <, or any spaces.'));
}
if ($passwordNew) {
if ($passwordNew != $passwordNewConfirm) {
$e->add(t('The two passwords provided do not match.'));
}
}
$data['uPasswordConfirm'] = $passwordNew;
$data['uPassword'] = $passwordNew;
}
$aks = UserAttributeKey::getEditableInProfileList();
foreach($aks as $uak) {
if ($uak->isAttributeKeyRequiredOnProfile()) {
$e1 = $uak->validateAttributeForm();
if ($e1 == false) {
$e->add(t('The field "%s" is required', $uak->getAttributeKeyName()));
} else if ($e1 instanceof ValidationErrorHelper) {
$e->add($e1);
}
}
}
if (!$e->has()) {
$data['uEmail'] = $email;
if(ENABLE_USER_TIMEZONES) {
$data['uTimezone'] = $this->post('uTimezone');
}
$ui->update($data);
foreach($aks as $uak) {
$uak->saveAttributeForm($ui);
}
$this->redirect("/profile/edit", "save_complete");
} else {
$this->set('error', $e);
}
}