PDA

View Full Version : Adding credits on a new thread and new reply


neverstop
08-12-2009, 05:33 PM
Hi,

I have a custom column 'credits' in my user table.

I want to add 3 credits for a new thread and 1 credit for a reply in certain forums.

I tried assing a plugin at newpost_complete but it completely destroyed my board. Here is the code I used which I am sure is wrong:

if (in_array($foruminfo['forumid'],array(33,29,34,37)))
{

if ($type != 'thread')
{
$db->query_write("UPDATE " . TABLE_PREFIX . "user SET credits = credits+1 WHERE userid = $bbuserinfo[userid]");
}
else
{
$db->query_write("UPDATE " . TABLE_PREFIX . "user SET credits = credits+3 WHERE userid = $bbuserinfo[userid]");
}

}

I know the code is wrong but it should give you an idea of what I am tryingto accomplish.

cheers,
Ian