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!

Current Version: 1.2.3

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.

  1. Unzip and upload the plugin to your Wordpress plugin directory.
  2. Activate the plugin through the 'Plugins' menu in WordPress.
  3. Configure the plugin to your liking through the 'CubePoints' menu.
  4. 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

Note: Most sections below would require some knowledge in HTML, PHP and Wordpress.

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