We have certain promotions where users with special pricing need to log in before visiting a particular page.
So for example if we're trying to sell pumpkin seeds, retail customers and wholesalers both go to /pumpkin-seeds/ but wholesalers will see different prices. If they are not logged in they see wholesale prices.
If we direct them to the site with http://site.tld/login.html?return_url=pumpkin-seeds, and they are not authenticated already, they will be redirected to pumpkin seeds after logging in. However, for users that are already logged in, the link will take them to the root of the site.
Around line 248 of controllers/common/auth.php we have:
if (!empty($auth['user_id'])) { return array(CONTROLLER_STATUS_REDIRECT, fn_url()); }
If that section is like this instead:
if (!empty($auth['user_id'])) { if (!empty($_REQUEST['return_url'])) { $redirect_url = $_REQUEST['return_url']; } else { $redirect_url = fn_url(); } return array(CONTROLLER_STATUS_REDIRECT, $redirect_url); }