Hi,
The first and main issue I can see is that in the "registration" setting of the HikaShop configuration, you've selected "guest". And thus, what you see is a guest form, not a registration form.
I would recommend changing the "Display method for registration" setting to "selector" so that you could then select both "guest" and "registration" in the "registration" setting.
That way, on the registration form page, you would have a registration form.
Another issue I see is that you've added spaces between the quotes and the URL of the redirection.
Another issue is that I've made you add a check on the user_partner_activated parameter of the user, but on your registration form, you don't display the partner checkbox (thanks to the "Add a 'become a partner' checkbox on the registration form" option of the HikaShop configuration). In that case, this code will never redirect to your URL. So either you activate that option so that when registering the user can choose to become a partner or not, or you change the line:
if(!empty($user->user_partner_activated)) {
to:
if(true) {
so that the user is always redirected to your affiliate page after going through the registration page.
One other potential problem is that the hikashop_loadUser function might use a cached version of the data instead of the new user data. So just in case, I would recommend to add the line:
hikashop_loadUser(false, true);
before the line:
$user = hikashop_loadUser(true);
in order to clear the cache before loading the user data.