WordPress.org

Support

Remember user choice

Viewing 5 replies - 1 through 5 (of 5 total)
  • Having same issue.

    this used to work until i upgraded to 1.2

    Looking to revert back to v1.1

    I made a few modifications to my local version of the plugin. The main change I made was to use $_COOKIE instead of $_SESSION to store user choice. It works very well.

    Reverted back to v1.1 and all works fine now, but using $_COOKIE instead of $_SESSION makes far more sense to me too.

    Could you paste what changes you made and will apply myself.

    Presume majority of changes are after line 91 of any-mobile-theme-switcher.php??

    thanks

    Yes that’s correct. I replaced that section from 91 down with:

    //Force Theme Display request from visitor.
    if (@$_GET['am_force_theme_layout']){
    	//$_COOKIE['am_force_theme_layout'] 	=	$_GET['am_force_theme_layout'];
    	setcookie("am_force_theme_layout", $_GET['am_force_theme_layout']);
    	header("Location: /");
    	exit;
    }
    
    if (isset($_COOKIE['am_force_theme_layout'])){ //IF USER FORCE FOR THE THEME
    	if ($_COOKIE['am_force_theme_layout'] == 'mobile'){ // IF FORCED THEME IS MOBILE
    		$mobile_browser = get_option('iphone_theme');
    		add_filter('stylesheet', 'loadMobileStyle');
    		add_filter('template', 'loadMobileTheme');
    		$shown_theme = 'mobile';
    	}
    } else { // NORMAL THEME [PLUGIN DEFAULT]
    	if (!empty($mobile_browser)){
    		add_filter('stylesheet', 'loadMobileStyle');
    		add_filter('template', 'loadMobileTheme');
    		$shown_theme = 'mobile';
    	}
    }

    As simple as that. Yes, looking at it, that is that is required really.

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Remember user choice’ is closed to new replies.
Skip to toolbar