Remove use of is_profile_editable() replace by DB setting

New setting DB "profile.is_editable"
pull/2650/head
Julio Montoya 6 years ago
parent b6df3825b1
commit b1896c2484
  1. 1
      config/packages/twig.yaml
  2. 13
      main/auth/profile.php
  3. 3
      src/CoreBundle/Settings/ProfileSettingsSchema.php

@ -15,7 +15,6 @@ twig:
news_list:
messages_count:
message_link:
is_profile_editable:
administrator_name:
execution_stats:
course_session_block:

@ -80,7 +80,7 @@ if (api_get_setting('allow_message_tool') === 'true') {
EOF;
}
$tool_name = is_profile_editable() ? get_lang('ModifProfile') : get_lang('ViewProfile');
$tool_name = api_get_setting('profile.is_editable') === 'true' ? get_lang('ModifProfile') : get_lang('ViewProfile');
$table_user = Database::get_main_table(TABLE_MAIN_USER);
/*
@ -182,7 +182,7 @@ if (api_get_setting('registration', 'email') == 'true' && api_get_setting('profi
}
// OPENID URL
if (is_profile_editable() && api_get_setting('openid_authentication') == 'true') {
if (api_get_setting('profile.is_editable') === 'true' && api_get_setting('openid_authentication') == 'true') {
$form->addElement('text', 'openid', get_lang('OpenIDURL'), ['size' => 40]);
if (api_get_setting('profile', 'openid') !== 'true') {
$form->freeze('openid');
@ -200,7 +200,8 @@ $form->applyFilter('phone', 'trim');
$form->applyFilter('phone', 'html_filter');
// PICTURE
if (is_profile_editable() && api_get_setting('profile', 'picture') == 'true') {
if (api_get_setting('profile.is_editable') === 'true' &&
api_get_setting('profile', 'picture') === 'true') {
$form->addFile(
'picture',
[
@ -236,7 +237,7 @@ if (api_get_setting('profile', 'language') !== 'true') {
}
// THEME
if (is_profile_editable() && api_get_setting('user_selected_theme') == 'true') {
if (api_get_setting('profile.is_editable') === 'true' && api_get_setting('user_selected_theme') === 'true') {
$form->addElement('SelectTheme', 'theme', get_lang('Theme'));
if (api_get_setting('profile', 'theme') !== 'true') {
$form->freeze('theme');
@ -308,7 +309,7 @@ if (api_get_setting('extended_profile') === 'true') {
// PASSWORD, if auth_source is platform
if (is_platform_authentication() &&
is_profile_editable() &&
api_get_setting('profile.is_editable') === 'true' &&
api_get_setting('profile', 'password') == 'true'
) {
$form->addElement('password', 'password0', [get_lang('Pass'), get_lang('Enter2passToChange')], ['size' => 40]);
@ -356,7 +357,7 @@ if (api_get_setting('profile', 'apikeys') == 'true') {
);
}
// SUBMIT
if (is_profile_editable()) {
if (api_get_setting('profile.is_editable') === 'true') {
$form->addButtonUpdate(get_lang('SaveSettings'), 'apply_change');
} else {
$form->freeze();

@ -36,6 +36,7 @@ class ProfileSettingsSchema extends AbstractSettingsSchema
'enable_profile_user_address_geolocalization' => '',
'allow_show_skype_account' => '',
'allow_show_linkedin_url' => '',
'is_editable' => 'true'
]
)
->setTransformer(
@ -91,7 +92,7 @@ class ProfileSettingsSchema extends AbstractSettingsSchema
->add('enable_profile_user_address_geolocalization', YesNoType::class)
->add('allow_show_skype_account', YesNoType::class)
->add('allow_show_linkedin_url', YesNoType::class)
->add('is_editable', YesNoType::class)
;
}
}

Loading…
Cancel
Save