WordPress.org

Support

Support » How-To and Troubleshooting » Help with header email-address redirecting

Help with header email-address redirecting

  • robert.persson
    Member

    @robertpersson

    I’ve implemented a script which will redirect the email-address request by using headers.

    This works fine in Chrome and Firefox, however in IE the script will load the email client twice and after that display a blank page.

    How do I edit the script so that it only displays the client once and returns the user to the page from which the reequest was made?

    if (isset($_GET['staffMember'])) {
    	add_action('template_redirect', 'func_staffMail');
    }
    
    function func_staffMail() {
    	$user_ID = htmlspecialchars($_GET['staffMember']);
    	$user_info = get_userdata($user_ID);
    	$user_mail = $user_info->user_email;
    	if ($user_info) {
    		$ref = $_SERVER['HTTP_REFERER'];
    		header("Location: mailto://{$user_mail}");
    		die();
    	} else {
    		header('HTTP/1.0 404 Not Found');
    		die();
    	}
    }
  • The topic ‘Help with header email-address redirecting’ is closed to new replies.