Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- **
- * Implements hook_form_FORM_ID_alter() for user_register_form().
- */
- function username_generator_form_user_register_form_alter(&$form, &$form_state, $form_id) {
- $form['account']['#type'] = 'fieldset';
- $form['account']['name']['#suffix'] = '</div>';
- }
- drupal_add_js('function random_area_wrapper(name) { jQuery("#random-area-wrapper").html(name).slideDown(); }', 'inline');
- $form['Personal Information']['profile_date']['#default_value'] = array(
- 'day' => date('j'),
- 'month' => date('n'),
- 'year' => date('Y')
- );
- $form['Personal Information']['profile_date']['#after_build'] = array('__set_year_range');
- if (!user_access('administer users')) {
- $form['Personal Information']['profile_date']['#element_validate'] = array('age_validate');
- }
- }
- function age_validate($element, &$form_state) {
- $rid = autoassignrole_get_active_path_rid();
- $rid = array_diff($rid, array(0));
- $rid = reset ($rid);
- if (_role_access($rid, 'allow kids registration' ) || empty($rid)) {
- print_r($element);
- print_r($form_state);
- [values] => Array
- (
- [profile_date] => Array
- (
- [day] => 31
- [month] => 8
- [year] => 2001
- )
- )
- [input] => Array
- (
- [profile_date] => Array
- (
- [day] => 31
- [month] => 8
- [year] => 2001
- )
- )
- print_r($element);
- Array
- (
- [#default_value] => Array
- (
- [day] => 31
- [month] => 8
- [year] => 2017
- )
- [#after_build] => Array
- (
- [0] => __set_year_range
- )
- [#element_validate] => Array
- (
- [0] => age_validate
- )
- [#tree] =>
- [#parents] => Array
- (
- [0] => profile_date
- )
- [#array_parents] => Array
- (
- [0] => Personal Information
- [1] => profile_date
- )
- [#weight] => 0
- [#processed] =>
- [#required] =>
- [#attributes] => Array
- (
- )
- [#title_display] => before
- [#id] => edit-profile-date--2
- [#sorted] => 1
- [#validated] => 1
- )
- [#after_build_done] => 1
- )
- Array
- (
- [#default_value] => Array
- (
- [day] => 31
- [month] => 8
- [year] => 2017
- )
- [#after_build] => Array
- (
- [0] => __set_year_range
- )
- [#element_validate] => Array
- (
- [0] => age_validate
- )
- [#tree] =>
- [#parents] => Array
- (
- [0] => profile_date
- )
- [#array_parents] => Array
- (
- [0] => Personal Information
- [1] => profile_date
- )
- [#weight] => 0
- [#processed] =>
- [#required] =>
- [#attributes] => Array
- (
- )
- [#title_display] => before
- [#id] => edit-profile-date--2
- [#sorted] => 1
- [#validated] => 1
- )
- [#after_build_done] => 1
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement