I took the invite module and changed it to the refer module so that I could track customer referrals for an auto mechanic shop. The idea is to allow the web site to generate the referrals exactly as invites but that there are two new date fields indicating when the referral fee was paid for each of the referrer and referred user. So far so good but when invoked the menu_callback using 'page arguments' => array(4) the "reg_code" (the actual argument) is interpreted as a UID and somehow user_load() is called. There is an existing page callback, invite_admin_details(), that clearly expects this exact behaviour but it isn't what should be happening from what I understand.
Clearly something somewhere is changing that argument but I am at a loss as to figuring out where or even what to look for. There is a hook_menu_alter() and a hook_form_alter() but neither seem related and certainly do not call user_load(). I have asked the invite module issue queue #913478: Why does callback call user_load as well but thought perhaps people here might be able to answer faster. It is probably something simple but it eludes me (then again, I'm only an egg).
(in case it isn't obvious, this is something unique to the invite/refer code as far as I can tell, there are plenty of working examples where the above code provided the expected field of the URI).
Comments
hook_menu is the 'culprit'
In case other people are as dopey as me, the answer is that the actual name you use for the argument in the callback is used in the hook, so "%user" called the wrong module and "%reg_code" had no meaning but "%refer" does what I want it to do ....
You're close. The word used
You're close. The word used after the % sign calls the associated _load() function.
%user calls user_load().
%node calls node_load().
%refer calls refer_load().
(note - if the associated load function doesn't exist, you have to create it.
Contact me to contract me for D7 -> D10/11 migrations.