Due to an incorrect parameter we could not delete.

/**
 * Multiple group deletion confirmation form.
 */
function group_multiple_delete_confirm($form, &$form_state, $gids) {
  $form['#submit'][] = 'group_multiple_delete_confirm_submit';

  $form['groups'] = array(
    '#prefix' => '<ul>',
    '#suffix' => '</ul>',
    '#tree' => TRUE,
  );

  foreach ($groups as $gid) {
    $title = db_query('SELECT title FROM {groups} WHERE gid = :gid', array(':gid' => $gid))->fetchField();
    $form['groups'][$gid] = array(
      '#type' => 'hidden',
      '#value' => $gid,
      '#prefix' => '<li>',
      '#suffix' => check_plain($title) . "</li>\n",
    );
  }

  $form['info'] = array(
    '#markup' => t('By deleting a group you will delete all of its subgroups and content as well.'),
    '#suffix' => '<br />',
  );

  $question = format_plural(count($groups),
    'Are you sure you want to delete this group?',
    'Are you sure you want to delete these groups?'
  );

  return confirm_form($form, $question, 'admin/group', NULL, t('Delete'));
}

This should be the correct function

/**
 * Multiple group deletion confirmation form.
 */
function group_multiple_delete_confirm($form, &$form_state, $gids) {
  $form['#submit'][] = 'group_multiple_delete_confirm_submit';

  $form['groups'] = array(
    '#prefix' => '<ul>',
    '#suffix' => '</ul>',
    '#tree' => TRUE,
  );

  foreach ($gids as $gid) {
    $title = db_query('SELECT title FROM {groups} WHERE gid = :gid', array(':gid' => $gid))->fetchField();
    $form['groups'][$gid] = array(
      '#type' => 'hidden',
      '#value' => $gid,
      '#prefix' => '<li>',
      '#suffix' => check_plain($title) . "</li>\n",
    );
  }

  $form['info'] = array(
    '#markup' => t('By deleting a group you will delete all of its subgroups and content as well.'),
    '#suffix' => '<br />',
  );

  $question = format_plural(count($gids),
    'Are you sure you want to delete this group?',
    'Are you sure you want to delete these groups?'
  );

  return confirm_form($form, $question, 'admin/group', NULL, t('Delete'));
}

Comments

thim’s picture

the paramter is $gids yet the foreach uses $groups, but this $groups variable does not exists.
By simply replacing it with the parameter $gids the error was resolved

kristiaanvandeneynde’s picture

Yeah, that definitely needs fixing :)

oenie’s picture

Status: Active » Fixed

I noticed and fixed the same problem independently.
Fixed in commit ba3e71fc.

kristiaanvandeneynde’s picture

Thanks Jeroen!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

  • Commit 89cbc1a on 7.x-1.x, ctools_plugins, inheritance by oenie:
    Issue #2082503 by oenie, thim: /admin/Group.inc - incorrect parameter...