diff --git a/cod_session/cod_session.module b/cod_session/cod_session.module index 272de88..7171f9e 100644 --- a/cod_session/cod_session.module +++ b/cod_session/cod_session.module @@ -5,3 +5,23 @@ */ include_once('cod_session.features.inc'); + +/** + * Implementation of hook_form_alter(). + */ +function cod_session_form_alter(&$form, &$form_state, $form_id) { + // Prepopulate the current user into the Speakers field + // on new session creation. + if ($form_id == 'session_node_form') { + if (isset($form['field_speakers'])) { + // Form tweaks for the Speakers field: + $form['field_speakers']['field_speakers_add_more']['#value'] = t('Add another speaker'); + // Prepopulate the current user into the Speakers field + // on new session creation. + if (empty($form['#node']->nid)) { + global $user; + $form['field_speakers'][LANGUAGE_NONE][0]['uid']['#default_value'] = $user->uid; + } + } + } +} \ No newline at end of file