[wp-hackers] Plugin custom page

Mike Little wordpress at zed1.com
Tue Nov 20 23:44:02 UTC 2012


OK. I re-read your orginal post and understand what you are trying to do.

A quick and dirty solution is to use a shortcode.
create a page with that shortcode in it.

In the shortcode handler, do your processing.
pseudo code:

add_shortcode( 'voucher', 'my_voucher_shortcode_handler' );

function my_voucher_shortcode_handler( $atts, $content = null, $code = '' )
{
 if ( isset( $_POST['name'] ) && isset( $_POST['email'] ) && isset(
$_POST['voucher_code'] ) ) {
//validate and
 return 'pdf download link';
}
if ( isset( $_GET['voucher'] ) ) {
 $voucher_code = intval( $_GET['voucher'] ); // validate this properly
if ( need_login( $voucher_code ) ) {
 // output login form with voucher_code in hidden field
return get_login_form( $voucher_code );
 } else {
return 'pdf download link';
}
 }
return 'some default output';
}

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


More information about the wp-hackers mailing list