Answer the question
In order to leave comments, you need to log in
How to save changes in custom field?
Registration page. The bitrix:main.profile component.
Displaying a custom field:
global $USER;
$arFilter = array("ID" => $USER->GetID());
$arParams["SELECT"] = array("UF_VK");
$arRes = CUser::GetList($by,$desc,$arFilter,$arParams);
if ($res = $arRes->Fetch()) {
echo "<p><span>Адрес страницы вконтакте</span><br /><input type='text' name='NAME' maxlength='50' value='".$res["UF_VK"]."' /></p>";
}
<p><?echo $arResult["GROUP_POLICY"]["PASSWORD_REQUIREMENTS"];?></p>
<p><input type="submit" name="save" value="<?=(($arResult["ID"]>0) ? GetMessage("MAIN_SAVE") : GetMessage("MAIN_ADD"))?>"> <input type="reset" value="<?=GetMessage('MAIN_RESET');?>"></p>
<?// ********************* User properties ***************************************************?>
<?if($arResult["USER_PROPERTIES"]["SHOW"] == "Y"):?>
<div class="profile-link profile-user-div-link"><a title="<?=GetMessage("USER_SHOW_HIDE")?>" href="javascript:void(0)" onclick="SectionClick('user_properties')"><?=strlen(trim($arParams["USER_PROPERTY_NAME"])) > 0 ? $arParams["USER_PROPERTY_NAME"] : GetMessage("USER_TYPE_EDIT_TAB")?></a></div>
<div id="user_div_user_properties" class="profile-block-<?=strpos($arResult["opened"], "user_properties") === false ? "hidden" : "shown"?>">
<table class="data-table profile-table">
<thead>
<tr>
<td colspan="2"> </td>
</tr>
</thead>
<tbody>
<?$first = true;?>
<?foreach ($arResult["USER_PROPERTIES"]["DATA"] as $FIELD_NAME => $arUserField):?>
<tr><td class="field-name">
<?if ($arUserField["MANDATORY"]=="Y"):?>
<span class="starrequired">*</span>
<?endif;?>
<?=$arUserField["EDIT_FORM_LABEL"]?>:</td><td class="field-value">
<?$APPLICATION->IncludeComponent(
"bitrix:system.field.edit",
$arUserField["USER_TYPE"]["USER_TYPE_ID"],
array("bVarsFromForm" => $arResult["bVarsFromForm"], "arUserField" => $arUserField), null, array("HIDE_ICONS"=>"Y"));?></td></tr>
<?endforeach;?>
</tbody>
</table>
</div>
<?endif;?>
<?// ******************** /User properties ***************************************************?>
Answer the question
In order to leave comments, you need to log in
It's easiest like this:
<?
if ($arResult['DATA_SAVED'] == 'Y' AND $arResult["USER_PROPERTIES"]["SHOW"] == "Y")// заменяю иф в самом начале
ShowNote(GetMessage('PROFILE_DATA_SAVED'));
?>
<input type="text" name="UF_VK" maxlength="255" value="<?=$arResult["USER_PROPERTIES"]["DATA"]["UF_VK"]["VALUE"]?>" />
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question