Wordpress Plugin To Require Email For A Download ^new^ -

// 5. Secure Download Handler add_action( 'init', 'handle_secure_download' ); function handle_secure_download() if ( isset( $_GET['token'] ) ) $file = get_transient( 'download_token_' . $_GET['token'] ); if ( $file ) delete_transient( 'download_token_' . $_GET['token'] ); // One-time use header('Content-Description: File Transfer'); header('Content-Type: application/pdf'); readfile( $file ); exit;

MailOptin includes a feature called that protects any download link or even a whole page. wordpress plugin to require email for a download

Before we dive into the technical details, let's discuss the benefits of requiring email for a download: // One-time use header('Content-Description: File Transfer')

// 5. Secure Download Handler add_action( 'init', 'handle_secure_download' ); function handle_secure_download() if ( isset( $_GET['token'] ) ) $file = get_transient( 'download_token_' . $_GET['token'] ); if ( $file ) delete_transient( 'download_token_' . $_GET['token'] ); // One-time use header('Content-Description: File Transfer'); header('Content-Type: application/pdf'); readfile( $file ); exit;

MailOptin includes a feature called that protects any download link or even a whole page.

Before we dive into the technical details, let's discuss the benefits of requiring email for a download: