J'ai trouvé,
Il y a un second problème. Il faut changer la ligne:
$code = str_replace(array('[name]','[clean_name]','[subid]','','[key]','[flat]','[percent]','[value]','[prodid]'),array($user->name,$clean_name,$user->subid,$user->email,$key,$flat_amount,$percent_amount,$value),$code,$product_id);
en:
$code = str_replace(array('[name]','[clean_name]','[subid]','[email]','[key]','[flat]','[percent]','[value]','[prodid]'),array($user->name,$clean_name,$user->subid,$user->email,$key,$flat_amount,$percent_amount,$value,$product_id),$code);[email]','[key]','[flat]','[percent]','[value]','[prodid]'),array($user->name,$clean_name,$user->subid,$user->email,$key,$flat_amount,$percent_amount,$value),$code,$product_id);
en:
$code = str_replace(array('[name]','[clean_name]','[subid]','','[key]','[flat]','[percent]','[value]','[prodid]'),array($user->name,$clean_name,$user->subid,$user->email,$key,$flat_amount,$percent_amount,$value,$product_id),$code);[email]','[key]','[flat]','[percent]','[value]','[prodid]'),array($user->name,$clean_name,$user->subid,$user->email,$key,$flat_amount,$percent_amount,$value,$product_id),$code);