I know you can use header links such as <a href=" ' . $scripturl . '?variant=whatever"> for changing theme variants but this will redirect to the home page.
How can I change the url so that regardless of where someone is on the site they can change theme variants on a whim without being redirected to the home page?
In other words, I want the theme variant to change without moving the view from the current page.
This should work:
echo '<a href="' . $_SERVER['REQUEST_URL'] . (strpos($_SERVER['REQUEST_URL'], '.php?') !== false ? ';' : '?') . 'variant=whatever">Change it!</a>';
It does. :D I combined it with the other code here (http://www.simplemachines.org/community/index.php?topic=315942.msg2171251#msg2171251) and now have a changer that will change the variants permanently and without changing your location in the forum. Awesomesauce. Couldn't be better.