Back to vBulletin 3.5 Add-ons

Points Addon for Profile Comments
Mod Version: 1.00, by Reeve of shinra

This modification is in the archives.
vB Version: 3.5.3 Rating: (0 vote - 0 average) Installs: 11
Released: 16 Feb 2006 Last Update: 16 Feb 2006 Downloads: 16
Not Supported  

Points add on for the Profile Commenting System coded by Danny.VBT

This small add on lets you add or deduct points for new profile comments. You can use this with ebux, ucash, or any other system by changing the table and field info in the variable below.

QUICK NOTE: If your actually using decimals, this may round off the users points to the nearest whole #.

This is more or less all I needed but the same code could probably be reused for editing and deleting comments as well. If you want to enchance this in any way, by all means feel free to do so.

Step 1: Create a new phrase
(admincp -> languages and phrases -> phrase manager -> add new phrase)

Phrase Type: front end error messages
Product: vbulletin
Varname: error_not_enough_points
Text: Sorry but you do not have enough points to complete this action.

Step 2: Edit the "[Comments] Add Comment" plugin
(admincp -> Plugin System -> Plugin Manager)

Step 3: Add this code at the very top.
  • Change the cost to whatever you would like. Negative #'s deduct points. Postive #'s add points.
  • Change the table and field your points are stored in. If your are using ebux and do not have a table prefix, leave it alone.

PHP Code:
    /* **** Begin Points Hack **** */
    
    // Lets define some variables. 
    
$cost = -10// use negative numbers to deduct points for adding a comment
    
    // Where are your points stored? This is a default ebux without table prefix.
    
$pointstable 'user';                         // This is the table where the points are stored 
    
$fieldx      'ebux';                        // This is the field where users points are stored
    
    /* **** End Points Hack **** */ 

Step 4: Look for this code in the plugin

PHP Code:
    $addcomment $db->query_write("INSERT into " TABLE_PREFIX "space_comments (comment_title, comment_text, comment_date,  commenter_id, userid, commenter_name)
                                            VALUES ('" 
$db->escape_string($vbulletin->GPC['title']) . "','" $db->escape_string($parsed_text) . "','" TIMENOW "','" $vbulletin->userinfo['userid'] . "', '" $vbulletin->GPC['u'] . "','" $vbulletin->userinfo['username'] . "')
                                          "
); 
Step 5: Below that, add the following

PHP Code:
    /***** Begin Points Hack *****/
    
    // OKAY NO MORE EDITING! Lets begin doing points stuff
    
    // Lets see how many points the user has to start with
    
$userpointsqry $db->query_first("
        SELECT 
$fieldx FROM $pointstable 
        WHERE userid = " 
$vbulletin->userinfo['userid'] . "
    "
);
    
    
$userpoints = (int) $userpointsqry 0;
    
    
//Lets do a quick check to see if they have enough points. 
    
    
if ($cost 0)
        {
        if (
$userpoints abs($cost))
            {
            eval(
standard_error(fetch_error('error_not_enough_points')));
            }
        }
    
    
// A little math to add/subtract the cost from the users existing points.
    
$amt $userpoints $cost;
    
    
    
// Lets update the users points now that they have made a comment
    
$db->query_write("
        UPDATE 
$pointstable SET
        
$fieldx =  '" $db->escape_string($amt) . "'
        WHERE userid =  " 
$vbulletin->userinfo['userid']   . "
    "
);
    
/***** End Points Hack *****/ 
Step 6: Save it and your done!

Download

This modification is archived and cannot be downloaded.

Similar Mods

Add-On Releases Nexia's POINTS system - ADDON vBookie Modification Graveyard
arcade points addon vBulletin 3.0 Template Modifications

vblts.ru supports vBulletin®, 2022-2024