Я ответил на аналогичный вопрос в WordPress Ответы: Checkboxes in registration form.
Вам нужны крючки действия register_form
(для ввода ваших полей ввода) и user_register
(для его обработки). Остальная часть кода - всего лишь образец кода для проверки результатов на страницах «Профиль» и «Редактирование пользователя».
// REGISTRATION
add_action('register_form', 'signup_fields_wpse_87261');
add_action('user_register', 'handle_signup_wpse_87261', 10, 2);
// PROFILE
add_action('show_user_profile', 'user_field_wpse_87261');
add_action('personal_options_update', 'save_profile_fields_87261');
// USER EDIT
add_action('edit_user_profile', 'user_field_wpse_87261');
add_action('edit_user_profile_update', 'save_profile_fields_87261');
function signup_fields_wpse_87261() {
?>
<label>
<input type="checkbox" name="custom_feature_a" id="custom_feature_a" />
Enable feature A?
</label>
<br />
<label>
<input type="checkbox" name="custom_feature_b" id="custom_feature_b" />
Enable feature B?
</label>
<hr />
<?php
}
function handle_signup_wpse_87261($user_id, $data = null)
{
$feat_a = isset($_POST['custom_feature_a']) ? $_POST['custom_feature_a'] : false;
$feat_b = isset($_POST['custom_feature_b']) ? $_POST['custom_feature_b'] : false;
if ($feat_a)
{
add_user_meta($user_id, 'custom_feature_a', $feat_a);
}
if ($feat_b)
{
add_user_meta($user_id, 'custom_feature_b', $feat_b);
}
}
function user_field_wpse_87261($user)
{
$feat_a = get_user_meta($user->ID, 'custom_feature_a', true);
$feat_b = get_user_meta($user->ID, 'custom_feature_b', true);
?>
<h3><?php _e('Custom Fields'); ?></h3>
<table class="form-table">
<tr>
<td>
<label><?php
printf(
'<input type="checkbox" name="custom_feature_a" id="custom_feature_a" %1$s />',
checked($feat_a, 'on', false)
);
?>
<span class="description"><?php _e('Custom Feature A?'); ?></span>
</label>
</td>
</tr>
<tr>
<td>
<label><?php
printf(
'<input type="checkbox" name="custom_feature_b" id="custom_feature_b" %1$s />',
checked($feat_b, 'on', false)
);
?>
<span class="description"><?php _e('Custom Feature B?'); ?></span>
</label>
</td>
</tr>
</table>
<?php
}
function save_profile_fields_87261($user_id)
{
$feat_a = isset($_POST['custom_feature_a']) ? $_POST['custom_feature_a'] : false;
$feat_b = isset($_POST['custom_feature_b']) ? $_POST['custom_feature_b'] : false;
update_usermeta($user_id, 'custom_feature_a', $feat_a);
update_usermeta($user_id, 'custom_feature_b', $feat_b);
}
Вы используете стандартную или специальную регистрацию? Не прикасайтесь к таблице пользователей, для этого вам нужно 'user_meta'. – brasofilo
Регистрация по умолчанию прямо сейчас. –