Skip to content

Instantly share code, notes, and snippets.

@JudeRosario
Created August 3, 2016 13:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JudeRosario/14a690a739132dabdb04113861f329b0 to your computer and use it in GitHub Desktop.
Save JudeRosario/14a690a739132dabdb04113861f329b0 to your computer and use it in GitHub Desktop.
Affiliates + MP + Multisite
add_action( 'wp_footer', function(){
if( isset( $_COOKIE['affiliate_' . COOKIEHASH] ) ) {
$reference = isset($_GET['ref'])?$_GET['ref']:false;
@setcookie('affiliate_' . COOKIEHASH, 'aff' . md5(AUTH_SALT . $reference),
(time() + (60 * 60 * 24 * ((int) AFFILIATE_COOKIE_DAYS ))),
COOKIEPATH,
COOKIE_DOMAIN
);
}
}) ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment