[wp-hackers] Plugin custom page

Mike Little wordpress at zed1.com
Wed Nov 21 09:16:41 UTC 2012


On 21 November 2012 08:42, Chris Taylor - stillbreathing.co.uk <
chris at stillbreathing.co.uk> wrote:

> Hi Mike,
>
> Many thanks, but that isn't going to solve my problem either! Here's a
> basic workflow for a "open" voucher:
>
> 1) The user creates a voucher that is available to anyone (i.e. it
> doesn't require email registration to download)
> 2) The user puts the shortcode for that voucher on a page
> 3) A visitor clicks the link the shortcode generates (/?voucher=abc123)
> 4) The visitor downloads the resulting PDF file
>
>
Why are all these steps together? You are combining three different things
now:
* Admin/User creation of the voucher;
* distribution of the voucher URL; and
* visitor retrieval of the voucher.

They are three separate process that occur non-sequentially, and even by
different people.

If you split those three very separate processes you will find my solution
addresses all cases for visitor voucher retrieval.

If you need to respond with the pdf itself in the case of a open voucher,
you could do so on the template_redirect hook looking ahead into the
content of the already retrieved post/page for the shortcode. Though that's
always awkward because the visitor is left at an empty browser tab with
your url in the address bar after they have downloaded the file.


Mike
-- 
Mike Little
http://zed1.com/


More information about the wp-hackers mailing list