Skip to content

Instantly share code, notes, and snippets.

@ajgagnon
Created March 14, 2021 15:00
Show Gist options
  • Select an option

  • Save ajgagnon/e4f40dfbf7d8da482c7a361f574ce236 to your computer and use it in GitHub Desktop.

Select an option

Save ajgagnon/e4f40dfbf7d8da482c7a361f574ce236 to your computer and use it in GitHub Desktop.
Use a hash instead of email to prevent issues with Cloudflare
<?php
$email_hash = function_exists( 'hash' ) ? hash( 'sha256', $downloadable_product_permission->user_email ) : sha1( $downloadable_product_permission->user_email );
$files[ $download_id ]['download_url'] = trailingslashit( get_option( 'home' )) .'?download_file='.$item_product_id.'&order='. $downloadable_product_permission->order_key .'&uid='. $email_hash .'&key='. $download_id;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment