To modify the core code to allow custom redirection after deletion checks in Joomla, you can use the `onUserBeforeDelete` event in a Joomla plugin. Here is an example of how you can use this event to redirect unauthorized users to a custom page:
php
class PlgUserExample extends JPlugin
{
public function onUserBeforeDelete($user)
{
// Check if the user is unauthorized
if (!$user->authorized) {
// Redirect to a custom page
$url = JRoute::_('index.php?option=com_mycomponent&view=myview', false);
$app = JFactory::getApplication();
$app->redirect($url);
}
}
}
This plugin will check if the user is authorized before deletion. If the user is not authorized, it will redirect them to a custom page specified by the `$url` variable.
Example Code for Redirecting After Deletion Checks
Here is an example of how you can use the `onUserAfterDelete` event to redirect users to a custom page after deletion checks:
php
class PlgUserExample extends JPlugin
{
public function onUserAfterDelete($user, $success, $msg)
{
// Redirect to a custom page
$url = JRoute::_('index.php?option=com_mycomponent&view=myview', false);
$app = JFactory::getApplication();
$app->redirect($url);
}
}
This plugin will redirect users to a custom page after the deletion checks are completed.
Example Code for Redirecting to a Custom Page After Profile Edit Submission
Here is an example of how you can use the `onUserAfterSave` event to redirect users to a custom page after profile edit submission:
php
class PlgUserExample extends JPlugin
{
public function onUserAfterSave($user, $isNew, $success, $msg)
{
// Check if the user is not new
if (!$isNew) {
// Redirect to a custom page
$url = JRoute::_('index.php?option=com_mycomponent&view=myview', false);
$app = JFactory::getApplication();
$app->redirect($url);
}
}
}
This plugin will redirect users to a custom page after they have updated their profile information.
Example Code for Redirecting to a Custom Page After User Deletion
Here is an example of how you can use the `onUserAfterDelete` event to redirect users to a custom page after user deletion:
php
class PlgUserExample extends JPlugin
{
public function onUserAfterDelete($user, $success, $msg)
{
// Redirect to a custom page
$url = JRoute::_('index.php?option=com_mycomponent&view=myview', false);
$app = JFactory::getApplication();
$app->redirect($url);
}
}
This plugin will redirect users to a custom page after a user has been deleted.
Example Code for Redirecting to a Custom Page After Profile Edit Submission Without a Plugin
Here is an example of how you can redirect users to a custom page after profile edit submission without using a plugin:
php
$url = 'index.php?option=com_mycomponent&view=myview';
$app = JFactory::getApplication();
$app->setUserState('com_users.edit.profile.redirect', $url);
This code sets a user state to redirect to a custom page after profile edit submission.
Citations:[1] https://docs.unrealengine.com/4.27/en-US/ProgrammingAndScripting/ProgrammingWithCPP/Assets/CoreRedirects/
[2] https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000A8mhWSAR
[3] https://joomla.stackexchange.com/questions/14535/edit-profile-redirect-on-submission
[4] https://www.reddit.com/r/dotnet/comments/9vc6ym/custom_redirect_for_authorization_policy_failure/
[5] https://support.zendesk.com/hc/en-us/articles/4408886627866-Can-I-redirect-traffic-from-deleted-help-center-articles