In order to get the functionality you are looking for, you’ll have to modify the code. In mod.permission.php, find the function assign() and change it to the code below (ive denoted my edits with ‘drch edit’ and there are 2 of them).
To use it, do the same as you would with approve[], but instead use delete[] (with the square brackets).
function assign()
{
global $DB, $FNS, $IN, $LANG, $LOC, $PREFS, $REGX, $SESS;
// -------------------------------------------
// Logged in?
// -------------------------------------------
if ( $SESS->userdata['member_id'] == 0 )
{
return $this->_fetch_error( $LANG->line('not_logged_in'), $IN->GBL('template') );
}
// -------------------------------------------
// Permission id
// -------------------------------------------
if ( ! $this->permission_id = $IN->GBL('permission_id') )
{
return $this->_fetch_error( $LANG->line('no_permission_id'), $IN->GBL('template') );
}
// -------------------------------------------
// Check Form Hash
// -------------------------------------------
if ( $PREFS->ini('secure_forms') == 'y' )
{
$query = $DB->query("SELECT COUNT(*) AS count FROM exp_security_hashes WHERE hash='".$DB->escape_str($_POST['XID'])."' AND ip_address = '".$IN->IP."' AND date > UNIX_TIMESTAMP()-7200");
if ($query->row['count'] == 0)
{
return $this->_fetch_error( $LANG->line('not_authorized'), $IN->GBL('template') );
}
$DB->query("DELETE FROM exp_security_hashes WHERE (hash='".$DB->escape_str($_POST['XID'])."' AND ip_address = '".$IN->IP."') OR date < UNIX_TIMESTAMP()-7200");
}
// -------------------------------------------
// Prepare approves
// -------------------------------------------
$_POST = $REGX->xss_clean( $_POST );
$approves = array();
if ( $IN->GBL( 'approve', 'POST' ) )
{
if ( is_array( $_POST['approve'] ) )
{
foreach ( $_POST['approve'] as $val )
{
$approves[ $val ] = $val;
}
}
else
{
$approves[ $val ] = $_POST['approve'];
}
}
//drch edit
//prepare a list of member id's to delete
$deletes = array();
if ( $IN->GBL( 'delete', 'POST' ) )
{
if ( is_array( $_POST['delete'] ) )
{
foreach ( $_POST['delete'] as $val )
{
$deletes[ $val ] = $val;
}
}
else
{
$deletes[ $val ] = $_POST['delete'];
}
}
//end drch
// -------------------------------------------
// Let's get real id's out of the DB.
// -------------------------------------------
$query = $DB->query( "SELECT post_id, approved, member_id, email FROM exp_permission_posts WHERE permission_id = '$this->permission_id'" );
// -------------------------------------------
// Handle existing requests
// -------------------------------------------
foreach ( $query->result as $row )
{
if ( in_array( $row['member_id'], $approves ) AND $row['approved'] == 'n' )
{
$DB->query( $DB->update_string( 'exp_permission_posts', array( 'approved' => 'y', 'edit_date' => $LOC->now ), array( 'post_id' => $row['post_id'] ) ) );
}
//drch edit
//if the member id is in deletes, remove from db.
elseif (in_array($row['member_id'], $deletes)) {
$DB->query( "DELETE FROM exp_permission_posts WHERE post_id = '".$row['post_id']."'" );
}
//end drch
elseif ( ! in_array( $row['member_id'], $approves ) AND $row['approved'] == 'y' )
{
$DB->query( $DB->update_string( 'exp_permission_posts', array( 'approved' => 'n', 'edit_date' => $LOC->now ), array( 'post_id' => $row['post_id'] ) ) );
}
unset( $approves[ $row['member_id'] ] );
}
// -------------------------------------------
// Approve additional
// -------------------------------------------
foreach ( $approves as $member_id )
{
$data = $this->_data();
$data['member_id'] = $member_id;
$data['approved'] = 'y';
$DB->query( $DB->insert_string( 'exp_permission_posts', $data ) );
}
// -------------------------------------------
// Return
// -------------------------------------------
$data['failure'] = FALSE;
$data['success'] = TRUE;
$data['message'] = $LANG->line('member_approved');
if ( $IN->GBL('template') )
{
if ( $body = $this->_fetch_template( $IN->GBL('template'), $data ) )
{
return $body;
}
else
{
$FNS->redirect( $IN->GBL('RET') );
}
}
elseif ( $IN->GBL('return') )
{
$FNS->redirect( $IN->GBL('return') );
}
else
{
$FNS->redirect( $IN->GBL('RET') );
}
}
// End assign