Wordpress Theme Switcher plugin redirect modification

Discussion in 'PHP' started by depi, Jul 29, 2007.

  1. #1
    Hello,

    I would like to modify the Theme Switcher Plugin for Wordpress (http://dev.wp-plugins.org/wiki/ThemeSwitcher). When I currently request the page to switch the theme (for example: mydomain.com/?wptheme=My+Theme) I'm redirected to the index.php, but instead I would like to redirect back to the page where I was before (for example: mydomain.com/?p=15)

    Here is the code which is redirecting the page:
    
    function ts_set_theme_cookie() {
    	$expire = time() + 30000000;
    	if (!empty($_GET["wptheme"])) {
    		setcookie("wptheme" . COOKIEHASH,
    							stripslashes($_GET["wptheme"]),
    							$expire,
    							COOKIEPATH
    							);
    
    		$redirect = get_settings('home').'/';
    
    		if (function_exists('wp_redirect'))
    			wp_redirect($redirect);
    		else
    			header("Location: ". $redirect);
    
    		exit;
    	}
    }
    
    PHP:
    I've tried to change the $redirect variable to $_SERVER['REQUEST_URI'] but it doesn't worked. Any recommendations how to do it? I will really appreciate it.

    Thanks,
    Erik
     
    depi, Jul 29, 2007 IP