Plugin Author
Yusuf
(@byoozz)
Thanks sterlo for the patch, but I already use this :
$wp_admin = substr_count($_SERVER['REQUEST_URI'], '/wp-admin/');
$wp_login = substr_count($_SERVER['REQUEST_URI'], '/wp-login.php');
if ($wp_login > 0 || $wp_admin > 0) {
$get = get_option('wpmd_db_options');
if ($_SERVER['SERVER_NAME'] == $get['domain']) {
ywpmd_create_cookie();
header ('location:'.WPMD_SITEURL.'/wp-login.php');
die();
}
}
maybe I’ll use your code in the next version.
Hey byoozz:
I submitted the patch because I broke an alpha site testing the plugin.
I added “firefox” to the list of mobile clients – just to test the redirection. I told it to redirect me to google.com and from then on, even in the admin area, it did that.
The patch I submitted, is basically intended to say “Do not perform redirections if in the administration area”.
The function ywpmd_options currently causes the problem, which is what my patch addresses.
It hooks here: add_action(‘init’, ‘ywpmd_options’);
Which means that theres nothing stopping it from redirecting.
I do see your code here (starting at line 61):
$wp_admin = substr_count($_SERVER['REQUEST_URI'], '/wp-admin/');
$wp_login = substr_count($_SERVER['REQUEST_URI'], '/wp-login.php');
if ($wp_login > 0 || $wp_admin > 0) {
$get = get_option('wpmd_db_options');
if ($_SERVER['SERVER_NAME'] == $get['domain']) {
ywpmd_create_cookie();
header ('location:'.WPMD_SITEURL.'/wp-login.php');
die();
}
}
But that comes AFTER line 38…so the problem still exists.
It’s an edgecase – but one I can tell could cause a user a very painful experience if not fixed.
Thanks for the hard work!
Plugin Author
Yusuf
(@byoozz)
you were right sterlo, I fixed it.
Thanks