Fixed Deleting option does not redirect back to option group

Affected version
2.1.8 PL2

TickTackk

Well-known member
This is because when someone clicks on the "Delete" button it has the _xfRedirect param in the URL but when submitting the form, the _xfRedirect is not available. So the simplest fix would be to make the actionDelete in src/XF/Admin/Controller/Option.php pass the _xfRedirect to to the confirm URL:

PHP:
    public function actionDelete(ParameterBag $params)
    {
        $option = $this->assertOptionExists($params['option_id']);
        if (!$option->canEdit())
        {
            return $this->noPermission();
        }

        $returnUrl = $this->getDynamicRedirect(
            $this->buildLink('options'), false
        );
        $confirmUrl = $this->buildLink('options/delete', $option, [
            '_xfRedirect' => $returnUrl
        ]);

        /** @var \XF\ControllerPlugin\Delete $plugin */
        $plugin = $this->plugin('XF:Delete');
        return $plugin->actionDelete(
            $option,
            $confirmUrl,
            $this->buildLink('options/edit', $option),
            $returnUrl,
            $option->title
        );
    }
 
Last edited:

XF Bug Bot

XenForo bug fixer bot
Staff member
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.1.10).

Change log:
Redirect back to the option group when deleting an option.
There may be a delay before changes are rolled out to the XenForo Community.
 
Top