diff --git a/drupalorg/drupalorg.module b/drupalorg/drupalorg.module index 4b30e2d1c9850fce4b675aa68395faa05572ab47..88948804b22bd683adf445b5f3c793503768cbb5 100644 --- a/drupalorg/drupalorg.module +++ b/drupalorg/drupalorg.module @@ -169,7 +169,7 @@ function drupalorg_page_build(&$page) { } } - if (user_is_logged_in()) { + if (user_is_logged_in() && current_path() !== 'welcome') { $account = user_load($GLOBALS['user']->uid); // Nag about agreeing to ToS. @@ -3235,7 +3235,7 @@ function drupalorg_form_user_profile_form_alter(&$form, &$form_state) { // Be welcoming. if (isset($form_state['drupalorg_welcome'])) { - $to_show = array( + $to_show = [ 'field_first_name', 'field_last_name', 'field_country', @@ -3244,12 +3244,13 @@ function drupalorg_form_user_profile_form_alter(&$form, &$form_state) { 'timezone', 'field_demographics', 'field_subscribe_to', + 'field_terms_of_service', 'actions', // Without these, the user won't be updated. 'form_build_id', 'form_token', 'form_id', - ); + ]; // Hide anything that we haven't said to show. foreach (array_diff(element_children($form), $to_show) as $item) { @@ -3264,16 +3265,17 @@ function drupalorg_form_user_profile_form_alter(&$form, &$form_state) { $group->format_settings['formatter'] = 'open'; } - $form['#group_children'] = array( + $form['#group_children'] = [ 'field_country' => 'group_left', 'field_first_name' => 'group_left', 'field_last_name' => 'group_left', 'field_organizations' => 'group_left', 'field_demographics' => 'group_left', + 'field_terms_of_service' => 'group_left', 'picture' => 'group_right', 'timezone' => 'group_right', 'field_subscribe_to' => 'group_right', - ); + ]; // Put picture at the top. $form['#pre_render'][] = 'drupalorg_form_user_profile_move_picture'; @@ -7479,6 +7481,16 @@ function drupalorg_user_presave(&$edit, $account) { } } +/** + * Implements hook_user_insert(). + */ +function drupalorg_user_insert($edit, $account) { + // Always redirect new accounts to /welcome. + if (isset($edit['openid_connect_client'])) { + $_GET['destination'] = 'welcome'; + } +} + /** * Implements hook_user_update(). */