Closed (fixed)
Project:
Group
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
5 Sep 2013 at 13:36 UTC
Updated:
22 Apr 2014 at 13:48 UTC
Jump to comment: Most recent
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
Comment #1
thim commentedthe 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
Comment #2
kristiaanvandeneyndeYeah, that definitely needs fixing :)
Comment #3
oenie commentedI noticed and fixed the same problem independently.
Fixed in commit ba3e71fc.
Comment #4
kristiaanvandeneyndeThanks Jeroen!