Affiliate plugin : COOKIEHASH not set at the end of affiliate_ in cookie

I am having an issue with my own plugin added to mu-plugins/affiliatelite/plugins

My function is called when action of wpmu_new_user is fired.

I use the same cookie or ref check as in the handle_affiliate_link function of affiliatelite.php

The problem is, the COOKIEHASH constant. I can see a cookie is set on my pc when I use an affiliate link and it has a name of affiliate_ but when I see the cookie set by premium.wpmu.dev called affiliate_234j3hk3j4etc, how come they look different?

It seems as if when the cookie is set, COOKIEHASH has no value so it isn't appended to the name of the cookie in my install.

I can see in my live install under 'your referrals' there is data being collected for unique clicks for my affiliates but no signups are showing even though one of the affiliates claims his friend signed up for a blog through his link.

Can you tell me if affiliatelite.php is definitely setting the right cookie name? I'm worried my install isn't working because of the missing hash on the end of the cookie name..

My function is below, it wont pick up the $hash = addslashes($_COOKIE['affiliate_'.COOKIEHASH]);
because COOKIEHASH is set to SETMECOOKIEMONSTER and the cookie that is on my machine is called affiliate_

If I set my file to look for $_COOKIE['affiliate_'] then the function picks up the hash and can search the usermeta table for it and then allocate the affiliate as the referred_by value in the new users meta data.

Is there something I am missing? my live installs use the standard affiliatelite plugin and the cookies that are set by that don't have the extra bits on the end of affiliate_ either

function run when wpmu_new_user action is fired (from the file in mu-plugins/affiliatelite/plugins)

global $wpdb;
	$affiliatedata = $wpdb->base_prefix.'affiliatedata';
	if(isset($_GET['ref'])){
		// user has clicked an affiliate link
		$aff_user_id = $wpdb->get_var( $wpdb->prepare( "SELECT user_id FROM {$wpdb->usermeta} WHERE meta_key = 'affiliate_reference' AND meta_value='%s'", $_GET['ref']) );
	} elseif(isset($_COOKIE['affiliate_'.COOKIEHASH])){
		$hash = addslashes($_COOKIE['affiliate_'.COOKIEHASH]);
		$aff_user_id = $wpdb->get_var( $wpdb->prepare( "SELECT user_id FROM {$wpdb->usermeta} WHERE meta_key = 'affiliate_hash' AND meta_value = %s", $hash) );
	} else {
		$aff_user_id = 1; // default is admin
	}
	// store referred by value
	// (if exists but not if same as own user_id)
	// (store as admin if no affiliate link or cookie set)
	$referred_by = get_usermeta($userid,'referred_by');
	if(!$referred_by && $referred_by != $userid){
		//store in users meta table
		update_usermeta($userid,'referred_by',$aff_user_id);
		// notify affiliate of referral
		$aff_info = get_userdata($aff_user_id);
		$to = $aff_info->user_email;
		$user_info = get_userdata($userid);
		$referral_name = $user_info->display_name;
		$subject = "[ComLuv] You have referred a new user!";
		$message = "Congratulations, you have referred $referral_name to The ComLuv Network.\n".
		"You will receive a commission into your affiliate account every time this user purchases".
		" credits. If they upgrade to be a supporter then you will get earn every time they pay!";
		wp_mail($to,$subject,$message);
	}

[edit] ^^ this code formatting needs work! tried it in code tags but it added br/> on every line.