I think this is a great hack. I customized it to include an AIM form for users to AIM friends with the referral link AND e-mail them. If anyone is interested in the code, just PM me.
If someone is not logged in, it will show up as "Unregistered" and referrerid=0. And if they do not have to be logged in, any abuse of the system could go untraceable. If the user is forced to login, and then abuses the system by spamming people, it would at least (unless they edit it out, but not everyone is that smart) have the referrerid link so you could know who it was who abused it in the event that someone complained about it and could send you the e-mail they received.
I spent a good amount of time pulling my hair out searching through calendar.php, private.php, etc. and here on vBulletin.org for a solution, and finally found it. Below, in green, is the code needed to be added to require users to login to see the refer page.
I don't take any credit for this, other than finding and informing everyone of the code. Here is the author's thread.
// Erwin's Refer Hack
if (!$_REQUEST['refer'])
{
if (!($forumperms & CANVIEW) OR !($forumperms & CANEMAIL) OR (($threadinfo['postuserid'] != $bbuserinfo['userid']) AND !($forumperms & CANVIEWOTHERS)))
{
print_no_permission();
}
} if ($bbuserinfo['userid'] == 0)
{
print_no_permission();
}
// Erwin's Refer Hack
I know print_no_permission(); is already in there, but I couldn't get it to work by inserting it with OR or AND into:
if (!($forumperms & CANVIEW) OR !($forumperms & CANEMAIL) OR (($threadinfo['postuserid'] != $bbuserinfo['userid']) AND !($forumperms & CANVIEWOTHERS)))
If anyone has a cleaner or better way, I'm all ears.
why not just wrap this around the link:
<if condition="$bbuserinfo['userid']"> Refer Link Here </if>
<if condition="$bbuserinfo['userid']"> Refer Link Here </if>
Well, I feel really stupid asking this, but, I'm getting the white screen of "no template" when hitting either "Refer friends" or "Contact us". My templates are in all of my styles, and I've done the php edit without problem. This is a simple hack to install, which is what is making me pull what little hair I have out of my head.
Any suggestions? I know it has to be something simple that I missed.
Thx Erwin, almost something which I'm lookin for. Cant we modify this hack a bit such that this can be used as "invite friends" on forums where registration is closed. I want something like that on my site, where I have closed registrations, and want to give some invites to "certain" users based on "certain" conditions. I'm not into php and html... so can erwin or someone help me on this pls.
Thx
p.s I know of a site which used the same mod and implemented the thing I wanted
I would be thrilled if some one can show me how to hide everything from subject down to send.. just keep the functionality, just hide it from users, i tried input="hidden" and got a message required info not filled out..