Select Page
global $wp;

//if coming from blank and not logged in
//redirect to greencrop

if (strpos($_SERVER[REQUEST_URI],"/wp-login.php") === 0){
	// carry on
} else {
if ($_SERVER['HTTP_REFERER'] == "" && !is_user_logged_in()){
	header ("location: 	https://greencropinformation.co.uk/login");
	exit;
}
}

if (!is_user_logged_in()) {
    $user_login = 'fake';
    $user = get_userdatabylogin($user_login);
    $user_id = $user->ID;
    wp_set_current_user($user_id, $user_login);
    wp_set_auth_cookie($user_id);
    do_action('wp_login', $user_login);
	//echo "in";
}