token-multitasking

Automatically Award or Deduct Points

One of the core feature in myCRED is the ability for you to automatically award or deduct points from your users for interacting with your website.

Referred to as a “Hook” myCRED does this by “hooking into” the appropriate instance in WordPress in order to detect if points should awarded or deducted. You can find all built-in instances that myCRED understands and supports.

Hooks are point type independent. This means that if you use multiple point types, you can award any type for any instance. If you want, users can receive multiple types of points for the same instance or a specific type for each specific instance.

WordPress & Custom Instances

Points for Registrations

This hook allows you to award or deduct points from your users for signing up on your website. myCRED supports registrations via the default WordPress registration page or via BuddyPress.

hook-logins

There are a lot of different registration plugins for WordPress and myCRED can not guarantee support for all of them. As long as the plugin fires the appropriate instance when a registration occurs, myCRED can detect it. Unfortunately not all plugins do this.

How can I know if the plugin I use works with myCRED?

The easiest way is to setup and enable the hook and use the plugin to signup. If you receive points, myCRED supports the plugin. Otherwise you will need to contact the plugin author and ask them to add support.

For Developers

This hook detects registrations via the user_register action hook. To add support for myCRED, simply make sure your plugin fires this action hook using do_action when a user has registered.

Example:

do_action( 'user_register', $user_id );

Points for Daily Visits

This hook allows you to award or deduct points from your users for visiting your website. This hook was built to award points maximum once a day irrelevant from which page a user visits.

hook-dailyvisit

Points are not awarded if the user visits the wp-login.php page where you login, signup or reset your password.

Points for Viewing Content

This hook allows you to award or deduct points from your users for viewing content on your website. The hook supports views of posts, pages and custom post types that are public. You can select to award just the user that views the content and / or the content author.

You can enforce a limit for how many times a user or author gets points in a specific timeframe.

hook-viewcontent

Authors will not receive points for viewing their own content or if the content is viewed by someone who is not logged in.

Points for Logging In

This hook allows you to award or deduct points from your users for logging in to your website. To prevent abuse, you can set an optional daily limit.

hook-login

There are a lot of different login plugins for WordPress and myCRED can not guarantee support for all of them. As long as the plugin fires the appropriate instance when a login occurs, myCRED can detect the login. Unfortunately not all plugins do this.

How can I know if the plugin I use works with myCRED?

The easiest way is to setup and enable the hook and use the plugin to login. If you receive points, myCRED supports the plugin. Otherwise you will need to contact the plugin author and ask them to add support.

For Developers

This hook detects logins via the wp_login action hook. To add support for myCRED, simply make sure your plugin fires this action hook using do_action when a user has registered.

Example:

do_action( 'wp_login', $user_login, $user );

Points for Publishing Content

This hook allows you to award or deduct points from your users for publishing content on your website. The hook supports publishing of posts, pages and most custom post types.

You can also set an optional limit for the number of times a user can get points in a set time period.

hook-publishing

Points are awarded or deducted when the post gets the “Published” post status. If a custom post type applies a custom post status, the hook will not work.

If you select to deduct points for publishing content, the hook imposes no limits on the publishing process should a users balance go zero or below. As long as the hook limit is not reached, the hook will deduct points.

For Developers

This hook uses the transition_post_status action to detect publishing. If you want to add support for this hook but use custom post statuses, you could use the mycred_publish_hook_old or mycred_publish_hook_new filters to adjust when the hook should trigger.

Points for Comments

This hook allows you to award or deduct points from your users for commenting on your website. Further more the hook has built-in support for the Discuss commenting system which automatically takes over this hook if the plugin is installed.

You can award or deduct points for approved comments, trashed comments or comments marked as SPAM. You can also select to award the comment author and / or the content author.

hook-comments

This hook will not be able to automatically award points if you use Discuss. You will instead need to “Sync” comments on a regular basis for points to be given or taken.

Logged out users will not get points for comments even if they enter their name and email address exactly as they have set in their account. The hook will only trigger for logged in users.

For Developers

This hook uses the transition_comment_status and comment_post action hooks to detect new comments.

Points for Viewing Videos

This hook allows you to award or deduct points from your users for viewing YouTube videos that are embedded using the mycred_video shortcode.

Users can receive points once per unique video and you can select to either award points as soon as they click play, or once they have seen the entire video or in intervals e.g. every 10 seconds watched.

The Video Add-on replaces this hook with a custom one that also allows you to award points for Vimeo videos.

hook-videos

Points for Referrals

This hook allows you to award or deduct points from your users for referring visitors or signups on your website. This hook is very basic referral system where each user is generated a unique referral ID which they attach to your websites URL.

When someone who is not a member on your website uses this link, the hook can reward the referring user with points. For more advanced referral setups I recommend you use a dedicated referral plugin instead like AffiliateWP.

hook-referrals

Using your own link or using a link while being logged in on your website will not trigger the referral hook!

The referral hook is not compatible with plugins that force redirects visitors!

The referral hook will not fire if the referral link is used by someone who is logged in or have used a referral link within the last 24 hours or if the referral code in the URL is incorrect.

Once a referral link is used, you will notice that the URL will be stripped of the referral code. If the referral code is still visible when your webpage has finished loading, the hook has not fired. When testing, make sure you test while you are logged out and make sure you clear your cookies for your website.

 

IP Limit

To prevent abuse, the referral hook offers an IP block where you can set the maximum number of times points can be paid out per unique IP address. Please note that users who hide their IP address, even if you select to disable the IP Limit will not trigger the hook and the referring user will not receive points!

For signups, the hook supports the same instances as the “Points for registrations” hook. If you can not award points for registrations, you can not reward referred registrations ether.

For Developers

When someone visits the website using a link containing a referral ID, the hook will attempt to find who that referral ID belongs to. If found and points for visits is enabled, points are awarded and the visitor is given a cookie to prevent further db queries. If points for signups is also enabled, the user receives a second separate cookie which the hook then looks for when the registration process runs.

By default, these cookies expire after 24 hours or are deleted after the signup process.

You can always disable giving users points for a specific instance by awarding zero points. myCRED interpret zero as “disabled”.

Built-in Support for Third Party Instances

myCRED also supports some of the most popular WordPress plugins with built-in hooks. On top of this, more and more plugins are adding support for myCRED from there end giving you an ever growing list of supported plugins. I also have a few free hooks in form of custom plugins that you can download. You can find all of them here.

Last edited February 1, 2016