продолжаю патчить профайл.
Я хочу, чтобы у меня флажок "получать новости сайта" был отмечен по умолчанию.
Что я делаю:
profile.admin.inc, function profile_field_form(&$form_state, $arg = NULL), line 245
->
if ($type == 'checkbox') {
$form['fields']['options'] = array('#type' => 'checkbox',
'#title' => t('Checked by default'),
'#default_value' => isset($edit['options']) ? $edit['options'] : '',
'#description' => t('Specifies wether this checkbox should be checked by default'),
);
}
$form['fields']['visibility'] = array('#type' => 'radios',
$form['fields']['options'] = array('#type' => 'checkbox',
'#title' => t('Checked by default'),
'#default_value' => isset($edit['options']) ? $edit['options'] : '',
'#description' => t('Specifies wether this checkbox should be checked by default'),
);
}
$form['fields']['visibility'] = array('#type' => 'radios',
profile.module, function profile_form_profile($edit, $user, $category, $register = FALSE), line 389
->
(!) если в системе уже есть пользователи, это не применит флажок к ним.
Комментарии
Чтобы установить флажок profile_getnews для всех существующих пользователей выполните запрос:
select f.fid, uid, 1
from users u, profile_fields f
where u.status=1 and f.name='profile_getnews'
(измените названия таблиц, если используете префикс)
--
можно через devel -> execute php code
select f.fid, uid, 1
from {users} u, {profile_fields} f
where u.status=1 and f.name='profile_getnews'");