Calling all Drupal developers!
Help us get this on the first page of Digg. DIGG NOW!
Help us get this on the first page of Digg. DIGG NOW!
trackback_form_alter(&$form, $form_state, $form_id)
contributions/trackback/trackback.module, line 101
<?php
function trackback_form_alter(&$form, $form_state, $form_id) {
if ($form_id == 'node_type_form' && isset($form['identity']['type'])) {
$form['workflow']['trackback'] = array(
'#type' => 'radios',
'#title' => t('Trackbacks'),
'#options' => array(t('Disabled'), t('Enabled')),
'#default_value' => _trackback_node_type($form['#node_type']->type),
'#description' => t('Enable trackbacks for this node type.')
);
}
else if (isset($form['type']) && $form['type']['#value'] .'_node_form' == $form_id) {
$node = $form['#node'];
if (_trackback_node_type($node->type)) {
$form['trackback'] = array(
'#type' => 'fieldset',
'#title' => t('Trackbacks'),
'#collapsible' => TRUE
);
$form['trackback']['can_receive'] = array(
'#type' => 'checkbox',
'#title' => t('Allow Trackbacks'),
'#default_value' => isset($node->can_receive) ? $node->can_receive : 1,
'#description' => t('Allow other posts to send trackbacks to this content.')
);
$form['trackback']['trackback_urls'] = array(
'#type' => 'textarea',
'#title' => t('Send Trackbacks'),
'#default_value' => isset($node->trackback_urls) ? $node->trackback_urls : '',
'#cols' => 80,
'#rows' => 4,
'#description' => t('Enter one URL per line for each trackback you wish to send.')
);
// if there are any past successful trackbacks from this posting, add them to the node editing page.
// if there are any past unsuccessful trackbacks from this posting, add checkmarks to enable resending them
$past_successes_listing = array();
$options = array();
if (isset($node->nid)) {
$result = db_query('SELECT url, successful FROM {trackback_sent} WHERE nid = %d', $node->nid);
while ($url = db_fetch_object($result)) {
if ($url->successful) {
$past_successes_listing[] = $url->url;
}
else {
$options[$url->url] = $url->url;
}
}
}
// add listing of successfully trackbacked URLs
if (count($past_successes_listing)) {
$form['trackback'][] = array(
'#value' => theme('item_list', $past_successes_listing, t('Successful URLs'))
);
//t('These URLs have been successfuly pinged by this post.')
}
// add listing of unsuccessfully trackbacked URLs
if (count($options)) {
$form['trackback']['trackback_urls_to_retry'] = array(
'#type' => 'checkboxes',
'#title' => t('Unsuccessful URLs'),
'#default_value' => array(),
'#options' => $options,
'#description' => t('Attempts to ping these URLs with this post have failed. Mark a check next to the trackback URLs you wish to retry for this post.')
);
}
}
}
}
?>