MyBB Central

Full Version: MYPS referral system
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Can anyone make a feature that with every account a user refers, they will get a certain amount of points?
GMROCKS Wrote:Can anyone make a feature that with every account a user refers, they will get a certain amount of points?

The user who gives a user as reference gets points or the person they gave up as reference gets points ?
Oh excellent...yes I forgot about that. I will add it to the worktable and even make it a priority.
labrocca Wrote:Oh excellent...yes I forgot about that. I will add it to the worktable and even make it a priority.

I've just made this "addon" [ Just needs to be uploaded into the inc/plugins/ folder and activated ]. It adds a new option to the MYPS settings "MYPS per Referral"

On every registration it checks if the referrerbox is filled in, checks the username, if exists ... it adds the points to the myps of that user.
Not bad at all sir. You should make sure the user is activated though before giving credit.  

And these lines can be made simpler:

Code:
        $new_myps = $myps+$points;
            $update= array(
                "myps" => $new_myps,
                );
                
            $db->update_query(TABLE_PREFIX."users", $update, "uid='".$uid."'");
to this:
Code:
        $new_myps = $myps+$points;
                
    Â Â Â Â  $db->update_query(TABLE_PREFIX."users", $new_myps, "uid='".$uid."'");

That should work.

And why change the plugin code to alter the setting for myps_per_referral...it should be in the settings for MYPS with the activation.
labrocca Wrote:Not bad at all sir. You should make sure the user is activated though before giving credit.  

Why ? The referred user is probably active on the forum, else he wouldn't be set as a reference by others.

labrocca Wrote:
Code:
        $new_myps = $myps+$points;
            $update= array(
                "myps" => $new_myps,
                );
                
            $db->update_query(TABLE_PREFIX."users", $update, "uid='".$uid."'");
to this:
Code:
        $new_myps = $myps+$points;
                
         $db->update_query(TABLE_PREFIX."users", $new_myps, "uid='".$uid."'");

I always work that way, but your code should work also.

labrocca Wrote:And why change the plugin code to alter the setting for myps_per_referral...it should be in the settings for MYPS with the activation.

Why alter it ? Cause it aint there at the moment =P
You should add this to like 1.09 or some thing so you do not have to like have so many plugins for some thing simple.
hmm...I prefer modularity but this most likely will get into 1.09.

lex Wrote:Why ? The referred user is probably active on the forum, else he wouldn't be set as a reference by others.

No..I mean you shouldn't give a credit to the refferer UNTIL the person is activated. Otherwise I could sign up 10 people...never activate them and get referral credits.

You should make sure referrral system is enabled too.

Did you btw test this plugin?

You are hooking this to "member_do_register_end". You might want to try "member_activate_start" instead. It's more trouble but in this method it helps prevent cheating. You can set a parameter for the referral myps for either on activation or on signup in the admincp.

I notice your plugin does a count and addition of myps so I see why you want to change the parameter before activating. However that's dangerous because upon deactivation it doesn't subtract those myps and if you reactivate again...it will add once again. I will most likely add a HOOK to the recount in MYPS for situations like this. Expect some hooks in 1.09 since it seems some are interested in external module development.

Thanks.
labrocca Wrote:You should make sure referrral system is enabled too.
If it aint enabled, the field is blank and there's a check for that ... but if you change hooks, there needs to be check.

labrocca Wrote:Did you btw test this plugin?  
And yes i've tested it.


Edit ::

Changed with the new hook ^^
I get this while viewing boards.
Quote:Warning: Cannot modify header information - headers already sent by (output started at /homepages/2/d190280959/htdocs/flegh/inc/plugins/myps_ref.php:1) in /homepages/2/d190280959/htdocs/flegh/showthread.php on line 126
Pages: 1 2 3
Reference URL's