• REGISTRATION REQUIREMENTS:

    Your username here MUST MATCH your XenForo username (connected to your XF license).

    Once you have registered here, then you need to start a conversation at xenforo.com w/Bob and provide the following:
    1. Your XenForo License Validation Token
    2. The Domain Name associated with the License
    NOTE: Your account will be validated once ALL requirements are verified/met. Thank you for your patience.

Hey Bob xfrocks point system question

Russ

New Member
AMS Premium
CAS Premium
EMS Early Adopter
IMS Premium
LD Premium
RMS Premium
SC Premium
UBS Premium
I'd normally ask xfrocks but I know you have experience using his point stuff.

How hard would it be to implement a simple point threshold for every item someone submits.

Same thing in the options on the banking system where you can set points for new threads/post/likes ect... would it be feasible to do the same for submitted items?
 
You'd have to write an addon to extend bd bank to add in new criteria functionality. That new functionality would require you to listen in on the Showcase Item DataWriter _postSave method and check if its a NEW Item being created using isInsert() and then fire the bd bank transaction stuff.

There is also hackish type stuff you could do if you didn't care about all the bd bank transaction functionality... ie, you could just edit the Item Data writer, write a very simple _addToPoints method that fires on _postSave() isInsert().

/library/NFLJ/Showcase/DataWriter/Item.php

Your custom method would look something along the lines of this.. You need to change points_field (twice in the same line) to the actual field name in the xf_user table along with the amount of points to award (change 50 to 2 for example).
PHP:
    protected function _addToPoints()
    {
        $this->_db->query('
            UPDATE xf_user
            SET points_field = points_field + 50
            WHERE user_id = ?
        ', $this->get('user_id'));
    }

example if using stock bd bank cash and you wanted to award 50 points for creating a new showcase item...
PHP:
    protected function _addToPoints()
    {
        $this->_db->query('
            UPDATE xf_user
            SET bdbank_money = bdbank_money + 50
            WHERE user_id = ?
        ', $this->get('user_id'));
    }




Then you'd just need to modify the _postSave method and add a call to the isInsert() check
find this....
PHP:
        if ($this->isInsert())
        {
            if ($this->get('item_state') == 'visible')
            {
                $this->_updateAddCategoryItemsCount();
            }
        }

change to this....
PHP:
        if ($this->isInsert())
        {
            if ($this->get('item_state') == 'visible')
            {
                $this->_updateAddCategoryItemsCount();
            }
         
            $this->_addToPoints();
        }
 
Sweet Bob, I like the hackish way as I'd have no idea to do the other :)
 
Back
Top