PDA

View Full Version : Reward System: Point based


Valkyre
07-18-2001, 10:03 PM
I've noticed that most boards that have a type of reward system for it's members tend to have more people sticking around. I've seen some methods such as "Karma" work, where it has a point or number below the name of a user in the () fields, then has a smile or something to that degree to the left of it. A mod or admin can grant this 'karma' to it's users as a reward for good posts, and it also shows other members kind of how good they are. Therefore, more people strive to make good posts. The only hack I've seen like this is for UBB, so I thought someone should take up the project for vB. Here's an example of what I mean:

Valkyre: Member

Karma:

http://www.screamtherapy.net/images/smilies/smirk.gif (1)

Registered: Jul 2001
Location: Ventura, CA
Posts: 55

That's a smile reward-based system, you could always use text, or some other graphical repesentation to that degree. Anyone up for it?

BradC
07-19-2001, 03:23 AM
This looks interesting... I have seen this brougt many of times... on this here board and other boards.. Karma Hack... I thought I seen where someone had this.. or made a hack.. hmm

Well anyways... I might try to conjur something up on this maybe at work tommorow.. dunno if and when I get the time :)

If it is just for the admins and mods then it could be really simple.. I would think.. but I don't know without trying it and failing about 30000 times before I figure something out.. so I can move to line 2 :)

Valkyre
07-19-2001, 03:38 AM
Well thanks for replying at least. These taffers don't reply to these requests forever :D

BradC
07-19-2001, 03:50 AM
I am just trying to learn a lot about php.. so I will reply to all posts that interest me.. even if I cannot help :)

But I am sure this has been done.. maybe just not released heh

Reno of Shinra
08-03-2001, 12:27 AM
The basis of the karma hack is simple...

A small link is put at the end of every post. It leads to a screen where you can add or subtract karma points from a user.
Only moderators or admins can do this.

Their points can go positive or negative...

Options include having the board automatically email you when they get high enough... a way of noticing good members and possibly scouting new mods.

Or, if they get low enough... automatically banning their username.

Other features include variable amounts of points to give out in one shot, a record of which posts have already been praised or warned (preventing multiple mods from rewarding the same post), emailing the offender the reason why they got warned...

All of these are advanced options.

The owner of http://www.magictraders.com is the one who wrote the original UBB Karma hack.

Basically, the simplest verion of this hack would be a page where you put in admin/mod name and password, name of person to add/subtract from... and then some way to put in a variable number and indicate wether it was an addition or subtraction.

Then the page runs off and modifies a numerical value in the appropriate member's data record.

And this value is displayed under a user's name on the sidebar, like post count.

I don't know PHP... could anyone here come up with a simple hack for this sort of thing?

drives_fast
10-21-2001, 06:12 AM
anybody looked at this yet? I am looking for this to add to my "Site Supporter" hack (not my hack.....the hack on my site) to show how much members have donated.....the more they donate.......the more stars, buttons....whatever they get

Palmer ofShinra
10-22-2001, 06:11 AM
Well, after some time, I threw a simple version of this hack together for our board.

It's nothing fancy and pretty well completely tweaked for our specific setup.

But really, it's quite simple.

The short way to do it...

Add a Custom User Field. Call it Bonus Points or something.

Remember which field number it is (ours was 5, the first custom field we made)

Now, edit the Postbit template.
Right after where it says
Posts: $post[posts]

add
<br><a href="http://www.myboard.com/board/mod/points.php?action=points&userid=$post[userid]" target=_blank>Points: $post[field5]</a>
(change field5 to whichever number matches)

This displays the total points the user has and adds a link (opening in a new window) to give them points.

Then points.php should look something like this

<?php

error_reporting(7);

require("./global.php");

cpheader("<title>Your Title Here</title>");
echo "<p>";

$perms=getpermissions();
if (!$perms[ismoderator] and !$ismod=$DB_site->query_first("SELECT * FROM moderator WHERE userid=$bbuserinfo[userid]")) {
echo "<p>You do not have permission to do this!</p>";
exit;
}
if ($action=="points") {
$user=$DB_site->query_first("SELECT username FROM user WHERE userid='$userid'");
doformheader("points","dopoints");
maketableheader("Give Points to $user[username]");
makehiddencode("userid",$userid);
makehiddencode("username",$user[username]);
makeinputcode("Points to give","amount","");
doformfooter("Submit Points");
}

if ($HTTP_POST_VARS['action']=="dopoints") {
$userpointstr=$DB_site->query_first("SELECT field5 FROM userfield WHERE userid=$userid");
$userpoints = (int) $userpointstr[field5];
$amount = (int) $amount;
$pointstr = ($userpoints + $amount);
$DB_site->query("UPDATE userfield SET field5='$pointstr' WHERE userid=$userid");
echo "$username has been given $amount Points successfully.<br>";
}

cpfooter();
?>

Put this PHP file, named points.php, into your MOD folder.

Now that you have that... you have your basic Points giving and displaying down.
You can use the query

$userpointstr=$DB_site->query_first("SELECT field5 FROM userfield WHERE userid=$userid");

to fetch a user's current points anytime... what you do with that number is up to you.

On our fr\orum, the points (Called "Gil") are used as a virtual currency to buy things like custom titles and avatars.
I have a completely automated system for that set up too.

Juan
10-22-2001, 10:51 AM
This hack is what I've been looking for.

I cannot get it to work after following all the instructions correctly. When I click on points, I get a blank page on the mod/points.php file.

There must be something wrong in the points.php code and I haven't got enough knowledge to solve it miself.

Palmer ofShinra
10-22-2001, 11:49 PM
The URL should be "www.com/board/mod/points.php?action=points"

Edited the typo in my last post where the template edit URL had the wrong action= specified.

The ?action=points is what calls the subroutine... if it doesn't have that, the IF doesn't find anything to do.

You can change "points" to whatever you want, really.

Just make sure to change ALL occurances of it.

Juan
10-23-2001, 12:54 AM
Thank you. It works

OrangeFaygo
10-24-2001, 05:48 PM
I don't see it working at all, I sent this to one of my friends and it does not work.

When you go to add points all it does is replace numbers. Lets say that have 0 points, you type in to add 5, it adds 5. Ok now lets say you wish to add 7 more to that 5, well instead of adding 7+5 it just replaces it with 7.

Anyone else having this trouble, it was compied word for word (the link was fixed) and everything.

Please reply and help out with this.

Thanks

Palmer ofShinra
10-24-2001, 06:28 PM
Edited the above code to correct the typo I made...

See, I ripped the code out of my much more complex script with other related functions...

Then I renamed the variables to be generic (replacing Gil with Points) but I missed one.

Replace $usergilstr[field5] with $userpointstr[field5]

Or just copy/paste the above code again.

OrangeFaygo
10-24-2001, 06:41 PM
if you don't mind, could you tell what all else is in your "more complex" version? I am interested in it....

Juan
10-24-2001, 06:50 PM
I am to.

OrangeFaygo
10-24-2001, 07:00 PM
Once I get enough money together I have to get my own board, my friend will not let me test stuff on his for much longer. This is one hack I will be adding, I am going to customize it a little also while I still have some use of the board - I want my own though. Dunno how I can get $160 though.....

Still lemme know about that rest of your hack, I would like to see what all you have implemented, if this is just a section of it.

OrangeFaygo
10-24-2001, 11:51 PM
Also how do you split your Gil up? Like when a user wants a custom title, how many points are removed? I would just like some ideas for when I get my board (I hope soon - I have got some money today :))

Palmer ofShinra
10-25-2001, 07:32 AM
That's just the core of it.

I also have a quick and dirty utility that accepts a list of names and Gil amount to update in this format

Palmer ofShinra - 20
OrangeFaygo - 13
Random Name - -3
Temporary Account - 7

Hit submit and it'll update everyone's Gil totals... and you can use negatives like shown with Random Name.

As for purchasing and such...

http://130.94.171.148/board/store.php

Custom titles and avatars are handled through Usergroups, which required some hacking of Member.php to enable title/avatars based on usergroup rather than days registered/postcount which is default.

Temporary titles expire after 30 days, using the time() function and a simple IF statement in buildpostbit

The Babe of the Week and Rent A Forum functions are just simple email scripts, since those items require direct administrator intervention.

I don't really plan to release the code for this, as it's heavily personalized...
And my coding still sucks, as I'm a PHP newb. I've done a lot of things that likely could be done more efficiently.
But it works, which is my primary concern.

The main problem with releasing this is that I haven't documented the changes I've made... I know them, but couldn't list them off.
Most are just little tweaks to various files... some are kludgey workarounds. You may notice that the Store interface bears a striking resembalance to the Control Panel... this is because the CP was a proven design (that I like) and my HTML skillz are non-existant, as you can probably guess from my "style". So I borrowed it.
But to make it work properly, it had to use /board/admin/adminfunctions.php, which a file outside of the admin folder doesn't normally have access to.

Also as a result of relative paths, I had to place an extra copy of cp.css one directory below the forums (on the web root) so the script could find it.

There are lots of little fiddles like that, and I'm not sure I could find them all again, actually.

So releasing this isn't a likely possibility for some time, if ever.

Perhaps someday one of the HTML guru's on our staff will come up with something better

NOTE/REQUEST TO VB DEVELOPERS: Please add default options to allow users to use custom titles and/or avatars via other criteria than just days regged/postcount.
Even just adding a single field to useroptions to allow them on an individual basis would be nice. Usergroups as well.
Postcount is useless because we have a lot of spammers who like to jockey for postcount... they're amusing.[/note]

Neo
10-25-2001, 02:37 PM
wow... looks nice if there is anyway i can get this hack i would be more and thankful. I have been looking for something lke this for quit some time now.

OrangeFaygo
10-25-2001, 07:23 PM
Ok last question, how do you give the points out. I guess what I am trying to ask is what do the members do to earn Gil (Points)? And when they do something, how many Gil do you give them?

Reno of Shinra
10-25-2001, 08:11 PM
Originally posted by OrangeFaygo
Ok last question, how do you give the points out. I guess what I am trying to ask is what do the members do to earn Gil (Points)? And when they do something, how many Gil do you give them?

that's mod dependent. mods give out gils, based on good points, things done for the forum, as well as doing things for us.

In a sense we created a virtual currency for our members to use to buy things, and motivate them to post better stuff (not we reward good post, and not spamming "post + 1" type). we run contest that we have members signing up to join to earn gil, people bet it inside sporting events, and soon we'll have gaves that involve the usage of gil.

OrangeFaygo
10-25-2001, 08:16 PM
I would like to get a hold of the instructions to implement so that my friend could add that store to his later on. His board is not fully up yet but it will be soon and this would be a great addtion to his site. Is there any way, ANY, that you could send me some instructions to make the store happen??

Thanks.

Palmer ofShinra
10-26-2001, 06:49 AM
As I said... the code is all over the place, and most of it was done piecemeal.

Like, the having custom avatars and titles be controlled by usergroups... I did that before I even thought I could DO the Store.

I've edited almost all the admin files, and a goodly chunk of the base files as well to get this working, as well as writing 3 new PHP scripts from scratch.

It's not so much an addon hack as it is a tightly integrated part of our forums as a whole.

Some functions of it are dependant on other installed hacks, like the Newsfader.

Even if I could compile all the changes into an easily installable hack... I'm not sure I'd want to release it.

This was a pretty hefty investment of time, both in coding and learning php.

Plus it's our forum's edge... it's what we have and others don't.

If there's enough interest for it, I may consider selling licenses. Of course, after what happened to Overgrow, I may not.

In any case, my code is nowhere near his quality.
All proceeds would go towards paying for our server... as we currently have ZERO income from it.

OrangeFaygo
10-27-2001, 03:32 AM
That is nice, where would I obtain that hack at?

Neo
10-28-2001, 09:01 PM
hmm so is this hack going to be posted... i really want it.. its has been what i have been looking for...

Palmer ofShinra
10-29-2001, 08:35 AM
What hack? The points system is as good as done.

If ya'll insist, I can budle it up into a proper little hack distro...

As for our Store part...

Odds are I'm not going to release it, mainly because it's highly personalized towards our forum.

I would need a LOT of motivation if I were to consider cleaning up the code and releasing it.

And even then, I'd want to sell licenses... this wasn't a simple little 2 hour hack.

Neo
10-29-2001, 03:30 PM
that would be really great of you:D its a really great hack from what u have seen

Palmer ofShinra
11-03-2001, 09:21 AM
Done.

Hack is here: http://vbulletin.org/forum/showthread.php?s=&threadid=32060

Enjoy.