function biblio_admin_author_edit_form_submit in Bibliography Module 7
Same name and namespace in other branches
- 6.2 includes/biblio.admin.inc \biblio_admin_author_edit_form_submit()
- 6 biblio.admin.inc \biblio_admin_author_edit_form_submit()
- 7.2 includes/biblio.admin.inc \biblio_admin_author_edit_form_submit()
_state
Parameters
$form:
File
- includes/
biblio.admin.inc, line 2568 - biblio.admin.inc
Code
function biblio_admin_author_edit_form_submit($form, &$form_state) {
$op = $form_state['values']['op'];
switch ($op) {
case t('Save'):
if ($form_state['values']['drupal_uid'] == 0) {
$uid = $form['drupal_uid']['#default_value'];
$cid = 0;
}
else {
$uid = $form_state['values']['drupal_uid'];
$cid = $form_state['values']['cid'];
}
if ($uid) {
db_update('biblio_contributor_data')
->fields(array(
'drupal_uid' => 0,
))
->condition('drupal_uid', $uid)
->execute();
$result = db_query('SELECT data FROM {users} WHERE uid = :uid', array(
':uid' => $uid,
))
->fetchField();
$data = unserialize($result);
$data['biblio_contributor_id'] = $cid;
$v = serialize($data);
db_update('users')
->fields(array(
'data' => $v,
))
->condition('uid', $uid)
->execute();
}
$form_state['values']['name'] = (!empty($form_state['values']['prefix']) ? $form_state['values']['prefix'] . ' ' : '') . (!empty($form_state['values']['firstname']) ? $form_state['values']['firstname'] . ' ' : '') . (!empty($form_state['values']['initials']) ? $form_state['values']['initials'] . ' ' : '') . (!empty($form_state['values']['lastname']) ? $form_state['values']['lastname'] . ' ' : '') . (!empty($form_state['values']['suffix']) ? $form_state['values']['suffix'] : '');
$form_state['values']['name'] = trim($form_state['values']['name']);
$form_state['values']['md5'] = md5($form_state['values']['name']);
drupal_write_record('biblio_contributor_data', $form_state['values'], 'cid');
if (isset($form_state['values']['candidates']) && !empty($form_state['values']['candidates'])) {
biblio_admin_author_edit_form_merge_link($form_state);
}
break;
case t('Cancel'):
break;
}
}