/**
  * Send the user to the redirection target. If the redirection target is
  * not available (it's private, or it no longer exists), send the user to
  * the wp-login.php page.
  *
  * This method is intended to be used when an anonymous user attempts to
  * access a page or post that is only available to logged-in users.
  *
  * param integer $page_id The ID of the redirection target page.
  */
 function _redirect($page_id)
 {
     $proto = is_ssl() ? 'https://' : 'http://';
     $redirect_to = urlencode($proto . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
     $page = get_page($page_id);
     if (null === $page || MemberAccess::isPrivate($page)) {
         wp_redirect(site_url("wp-login.php?redirect_to={$redirect_to}"));
         exit;
     }
     wp_redirect(get_permalink($page->ID));
     exit;
 }