WordPress.org

Ready to get started?Download WordPress

Forums

Help with header email-address redirecting (1 post)

  1. robert.persson
    Member
    Posted 3 years ago #

    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();
    	}
    }

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 3 years ago by robert.persson
  • This topic is not resolved
  • WordPress version: 3.1.2