Introduction
CubePoints is a point management system designed for Wordpress blogs. Users can earn points by posting comments or creating posts on your site. To display user's points, just put <?php cp_displayPoints(); ?>
in your template or activate the sidebar widget. You may also allow user to donate/transfer points to one another.
Encourage your users to comment on your posts by offering them points which could be used to purchase items / upgrades / etc. Users will be awarded a certain number of points for each comment they make. If the comment is deleted from the admin panel, the points will automatically be deducted. CubePoints also comes with an admin panel which gives administrators the ability to alter the points of their users quickly and easily.
Credits: We have used the following scripts in CubePoints. Thank you for developing them!
Compatablity
CubePoints is designed and created for Wordpress 2.7 running on PHP 5. However, previous version of Wordpress and PHP should work as well.
Installation
Installing should be a piece of cake and take fewer than five minutes.
- Unzip and upload the plugin to your Wordpress plugin directory.
- Activate the plugin through the 'Plugins' menu in WordPress.
- Configure the plugin to your liking through the 'CubePoints' menu.
- Add the CubePoints widget to your blog to show users the number of points they currently have.
Configuration
Number of points for each comment
This setting allows you to set the number of points users will get for each comment they post.
Do not add points for posting comment button would set the input box value to 0. It won't have any affect until you have pressed "Update Options!"
Default value: 5
Number of points subtracted for deleting each comment
This setting allows you to set the number of points will be deducted from the user when his/her comment is deleted.
Do not subtract points on comment deletion button would set the input box value to 0. It won't have any affect until you have pressed "Update Options!"
Default Value: 20
Number of points for posting
This setting allows you to set the number of points users will get for each post they publish.
Do not add points for posting posts button would set the input box value to 0. It won't have any affect until you have pressed "Update Options!"
Default value: 5
Enable user-to-user donations
Choose whether you want to allow your users to donate points to other users.
Default value: Enabled ✓
Enable logging
Choose whether you want to log all point transactions. Turnning this feature off would allow your users to get points by just updating posts.
Default value: Enabled ✓
Prefix for display of points
Set the prefix which will be shown before the points.
Default value: $
Suffix for display of points
Set the suffix which will be shown before the points.
Default value: blank
Advanced Configuration
This section is meant for users who have some knowledge on HTML, PHP and Wordpress.
Customizing the Widget
The CubePoints widget which displays the number of points for the current logged in user can be edited in the cp_pointsWidget()
function.
Customizing the Donation Link
The donation link added to comments of users with accounts can be edited in the cp_addLink()
function.
Template Integration
Your template can be customized to better integrate with CubePoints.
Display User's Points
You could call the cp_displayPoints()
function to print the number of points for a user.
Function
cp_displayPoints( int $uid, int $return, int $format)
Parameters
int $uid: ID of a Wordpress user. Defults to current logged in user.
int $return: If set to 1, function will return the points display. Defaults to printing the number of points.
int $format: If set to 0, function will return the points as integer, without prefix and suffix. Defaults to returning points as formatted string.
Example
Display the points of the current logged in user. Function returns false if no user is logged in.
<php if(function_exists('cp_displayPoints')){ cp_displayPoints(); } ?>
Plugin Integration
CubePoints can also be easily integrated with other plugins. Other plugins can be coded such that certain actions trigger the cp_alterPoints()
function to add or subtract points from a specified user.
Function
cp_alterPoints( int $uid, int $points )
Parameters
int $uid: ID of a Wordpress user. To get the ID of the current logged in user, use the cp_currentUser()
function.
int $return: Number of points to add to the specified user.
Example
The following code will add 10 points to the current logged in user. If no user is logged in, no points will be added. You may input negative number to subtract points.
<php if( function_exists('cp_alterPoints') && is_user_logged_in() ){ cp_alterPoints(cp_currentUser(), 10); } ?>
Troubleshoot
This is a list of common problems users might face. If you have a problem which is not listed below, feel free to contact us.
My users are unable to donate points to other users.
Make sure you have enabled user-to-user donations in the CubePoints admin panel.
The widget does not display correctly on my sidebar.
Some themes are designed in a way that placing text in the sidebar looks weird. You might want to contact the designer of the theme or edit the widget manually.
My users are getting points when they update posts.
Make sure the logging function is turned on in the configuration page.
Changelog
- Version 1.2.3, January 22nd, 2009
- [Bugfix] Users with E_NOTICE turned on for error_reporting get the "Undefined index: q" error.
- [Bugfix] Users using older versions of PHP received the T_OBJECT_OPERATOR error.
- [Bugfix] Donation links removed from within the admin panel under comment management.
- [Feature] Added option to prevent certain users from showing up in the Top Users widget.
- Version 1.2.2, January 15th, 2009
- [Bugfix] Fixed bug where users are not sorted correctly in the Top Users Widget
- [Change] Improvements in internationalisation
- [Change] .POT files generated
- Version 1.2.1, January 12th, 2009
- [Bugfix] Performance issue with the Top Users Widget
- [Change] .PO/MO files added
- Version 1.2, January 11th, 2009
- [Feature] A logging system has been implemented in CubePoints.
- [Feature] New Stats Widget available! It shows the users with the highest number of points and the a count of their posts and comments.
- [Feature] Pagination in Admin Panel -> Manage Screen. You can now browse through long lists of users easily.
- [Feature] Added ability for logged in users to view points of other users from comments.
- [Change] GetText functions are now implemented in CubePoints files.
- [Bugfix] Fixed bug where users get points for updating posts. The logging feature has to be enabled to have this fix to work.
- [Bugfix] Thickbox CSS-related problems are now fixed. (Post title does not appear correctly, etc.)
- [Bugfix] Donate link appeared on widget even though donations are turned off.
- Version 1.1, January 2nd, 2009
- [Change] Ajax-fy Donation with Thickbox
- [Feature] Ability to add points for publishing post
- [Feature] Ability to customize (individually) amount of points to deduct or add upon deletion/comment/publish
- [Change] Removed Custom CSS option in Admin Panel, moved into a seperate CSS file under /cubepoints.css
- Version 1.0, December 27th, 2008
- Initial Release