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: 2.0

Compatablity

CubePoints is designed and created for WordPress 2.7 or above 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.

Languages & Translations

CubePoints is available in a number of languages. We would like to thank all translators for their effort and hard work. i18n is not yet available for Cubepoints 2.0

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 Ranks

Choose whether you want to ranks system to be activated.
Default value: Enabled ✓

Enable logging

Choose whether you want to log all point transactions. Turning 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

Hide the following users from Top Users List

Usernames input here will be excluded from the Top Users List in the widget/post tags (see below). Separate usernames with commas. This is also changeable from the Widget menu at Appearance -> Widgets.
Default value: blank

Authentication Key

You will not need to worry about this unless you plan to have an automatic increase over a period of time (such as, a "monthly salary" for all members). Type in an authentication key (can be as silly as "i_am_a_stupid_monkey_123"), and then copy the command displayed to your cron jobs configuration in your host's admin panel.

Reset all points

This option is under "CubePoints" -> "Manage" in the Admin Panel.

By pressing this button, ALL users' points will be reset. Use this feature with care as it cannot be undone!

Ranks System

You may use different ranks to motivate your users to gain more points. Follow the on-screen instructions to setup new ranks, and if a certain user reaches that amount of minimum points, his new rank will be shown in the About me page via "?" in his comment.

You may also use images for ranks too. Simply put your images in /wp-content/plugins/cubepoints/ranks folder, and in the Add Rank screen, specifiy the image's name in the folder. The image is recommended not to be bigger than 18px * 18px.

Modules System

Using the modules system to integrate with other plugins is easy. Simply add this code into your intergration codes, and your module information will be shown in CubePoints > Modules under WP Admin Panel

<?php
$cp_modules[] = array (
	name => 'Module Name',
	version => '1.0.0',
	url => 'Module URL',
	description => 'Module Description',
	api_version => '1.0 (Do not change)',
	author => 'Module Author',
	author_url => 'Author URL'
);
?>

Right now, there are not much features to be implemented, but more are to come.

Predefined Tags

Predefined tags can help you include points information from within a post or a page. For example, you might want to have a page listing the points of all users or just the top 10 users. You might also want to feature the top user on a page or a post. This section serves as a guide on how you could achieve this.

List Top Users

List the top x users with highest number of points.
Set x to 0 to display a list of all users.

Tag

[cubepoints toplist x]

Example

[cubepoints toplist 3]

Sample Output

  • James ($150)
  • Jack ($135)
  • Alvin ($110)

Display Name of Top x User

Displays the name of the top x user.

Tag

[cubepoints topuser-name x]

Example

[cubepoints toplist-name 2]

Sample Output

Jack

Display Points of Top x User

Displays the name of the top x user.

Tag

[cubepoints topuser-points x]

Example

[cubepoints toplist-points 3]

Sample Output

110
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 cubepoints_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.

cp_log(string $type, int $uid, int $points, int $source)

Use this function to log your actions. Results will show up in WP Admin Panel -> CubePoints -> Logs. Check custom_logs.php for details how to output custom log types.

Parameters

string $type: the "short name" to identify the action itself

int $uid: User ID of who received the points

int $points: How many points were changed?

int $source = Who/What changed the points? (e.g. donation donors, comment number)

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);
 	cp_log('hey', cp_currentUser(), 10, 1);
  }
?>

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