function content_profile_form_alter in Content Profile 6
Implementation of hook_form_alter().
File
- ./
content_profile.module, line 251
Code
function content_profile_form_alter(&$form, $form_state, $form_id) {
if ($form_id == 'node_type_form') {
$form['content_profile'] = array(
'#type' => 'fieldset',
'#title' => t('Content Profile'),
'#group' => 'additional_settings',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#weight' => 32,
);
$form['content_profile']['content_profile_use'] = array(
'#type' => 'checkbox',
'#title' => t('Use this content type as a content profile for users'),
'#default_value' => variable_get('content_profile_use_' . $form['#node_type']->type, FALSE),
);
}
elseif (isset($form['#node']) && $form['#node']->type . '_node_form' == $form_id && is_content_profile($form['#node'])) {
// Customize the redirect target and buttons of our own node forms.
if (arg(0) == 'user' && is_numeric(arg(1)) && arg(2) == 'edit' || arg(2) == 'profile') {
$form['buttons']['preview']['#access'] = FALSE;
$form['buttons']['delete']['#access'] = FALSE;
$form['#redirect'] = arg(2) == 'profile' ? 'user/' . $form['#node']->uid : $_GET['q'];
}
// Set the author value - note that this works only for admins.
if (!empty($_GET['uid']) && ($uid = intval($_GET['uid'])) && ($user = user_load($uid))) {
$form['author']['name']['#default_value'] = $user->name;
}
}
}