You are here

function guestbook_delete_entry_confirm in Guestbook 7.2

Same name and namespace in other branches
  1. 5.2 guestbook.module \guestbook_delete_entry_confirm()
  2. 5 guestbook.module \guestbook_delete_entry_confirm()
  3. 6.2 guestbook.module \guestbook_delete_entry_confirm()
  4. 6 guestbook.module \guestbook_delete_entry_confirm()
2 string references to 'guestbook_delete_entry_confirm'
guestbook_delete_entry_confirm_page in ./guestbook.module
guestbook_mollom_form_list in ./guestbook.module
Implements hook_mollom_form_list().

File

./guestbook.module, line 863

Code

function guestbook_delete_entry_confirm($form, $form_state, $uid, $entry_id) {
  $query = db_select('guestbook', 'g', array(
    'fetch' => PDO::FETCH_ASSOC,
  ));
  $query
    ->leftJoin('users', 'u1', 'u1.uid = g.author');
  $query
    ->leftJoin('users', 'u2', 'u2.uid = g.commentauthor');
  $query
    ->fields('g')
    ->fields('u1', array(
    'uid',
    'name',
    'data',
    'picture',
  ));
  $query
    ->addField('u2', 'name', 'commentby');
  $query
    ->condition('g.recipient', $uid)
    ->condition('g.id', $entry_id);
  $entry = $query
    ->execute()
    ->fetch();
  $form['entry_id'] = array(
    '#type' => 'value',
    '#value' => $entry_id,
  );
  $form['uid'] = array(
    '#type' => 'value',
    '#value' => $uid,
  );
  $form['#redirect'] = !empty($_GET['destination']) ? $_GET['destination'] : guestbook_path($uid);
  return confirm_form($form, t('Are you sure you want to delete this guestbook entry?'), NULL, theme('guestbook_entry', array(
    'uid' => $uid,
    'entry' => $entry,
    'confirm_delete' => TRUE,
  )), t('Delete'), t('Cancel'));
}