function flickr_form_user_profile_form_alter in Flickr 7
Implements hook_form_user_profile_form_alter(). Adds the Flickr form to the user profile form.
File
- ./
flickr.module, line 304 - The Flickr module.
Code
function flickr_form_user_profile_form_alter(&$form, &$form_state) {
if ($form['#user_category'] == 'account' && (user_access('view own flickr photos') || user_access('administer flickr'))) {
$account = $form['#user'];
$form['flickr'] = array(
'#type' => 'fieldset',
'#title' => t('Flickr settings'),
'#collapsible' => TRUE,
'#weight' => 4,
'#tree' => FALSE,
);
$form['flickr']['flickr_identifier'] = array(
'#type' => 'textfield',
'#title' => t('Flickr identifier'),
'#default_value' => empty($account->flickr['identifier']) ? '' : $account->flickr['identifier'],
'#description' => t('Enter either your Flickr username, URL path alias, the email address associated with your Flickr account, or your Flickr NSID. Leave this box empty to delete your Flickr page on this site.'),
'#maxlength' => 64,
);
$form['#validate'][] = 'flickr_user_account_form_validate';
if (isset($form['field_flickr_tags'])) {
// Move the Flickr fields in the fieldset on the user form.
// Only works for the default created Flickr field during install.
// To make them work on other fields copy the code for an existing field
// and substitute the field's machine name.
$form['flickr']['field_flickr_tags'] = $form['field_flickr_tags'];
unset($form['field_flickr_tags']);
}
}
}