[url removed, login to view]
When the privacy plugin is installed, you can set pages to be private to a user or group. This is set by editing the page you want to add the privacy to, in the Privacy tab.
What I want is a new option in that tab, "If a visitor is not logged in, redirect them to:", which lets you set another page as the target.
The page should be selected using a select-box which works exactly the same as the "Redirect On Login" option in user registration pages. To see a user registration page for an example, create a new page of type "Privacy", and look at the Options tab. Two things to note: 1) it has an option for "None", 2) it loads its options asynchronously. The code for this is already written, so use it.
On the front-end, non-logged-in visitors that open the protected page will be redirected immediately to the target page if a target page is set. Use the redirect() function for this. it sets proper headers, etc.
In order to have the reader redirected before any output is shown, you will need to use a trigger. For an example of that, see the Online Store plugin's plugin.php. It uses the "initialisation-completed" trigger, so you could copy that.