Code Snippets

This is an example how you can add BuddyPress notifications for users when they gain / lose myCRED points.

By default, myCRED will give users a badge automatically based on your setup. This snippet will allow you to create badges that will never be automatically awarded to users. These manual badges would need to be added manually by editing the user in the admin area.

This is a complete plugin for the display of the total current users myCRED awarded and lost points in front end. You can either use it through the post or page shortcode or by placing the shortcode within your theme template files at your desired location to suite your needs.

Reward your users for uploading files and photos, using Frontend Uploader. This awards the current logged in user 3 points upon the upload successfully completing. This action runs after form is uploaded.

Reward your users for completing units, modules or courses using WP Courseware!

Reward post authors with points for post views managed by WP Postviews.

By default, your users will get points when the order has been marked as paid. This code snippet will instead payout when an order has been marked as “Completed”. Using this codes shippet will add support for manual payments such as Check or Bank Transfer.

Creates a shortcode for displaying the user’s rank progress without the need for Visual Composer. It will allow you to display the current user’s rank progress bar (default), or enter a User ID to display that particular user’s rank progress. And lastly, the ability to show/hide the name of the user’s current rank, their next rank, and their points progress.

This code snippet will require your users to have 5000 points to create a group in BuddyPress. You can change the amount and point type to suit your needs.

This code snippet will make the buyer the new owner of a post set for sale using the Sell Content add-on in myCRED. Requires myCRED 1.6 or higher.

By default, when a user reaches the WooCommerce checkout page, and they can not afford to pay for their order using points, the gateway disables itself and the option to pay with points will not be visible. This can cause an error message to show up if myCRED is the only enabled gateway. By adding the following code snippet to your wp-config.php file, the gateway will forced to always show on the checkout page, even if the user can not afford to use it. Transactions of course will still be declined if they can not afford to pay!

By default, myCRED will not payout points to a buyer if they paid with points for an order in WooCommerce. This simple code snippet allows you to override this reward the buyer with points.

Exclude users who have the “Subscriber” role on your website from using myCRED. Once their role changes, they will gain access to myCRED.

Award / Deduct points for completing a Course, Lesson, Topic, or Quiz.

Award points for Following / Being Followed by other users. Version 1.0

Custom myCRED Hook allowing you to award / deduct points from users when they complete a quiz via the WP Pro Quiz Plugin. Requires myCRED 1.5.3 or higher.

This custom shortcode for administrators can allow you to set posts for sale based on category.

Change a users WordPress role based on their point balance.

Re-label myCRED to “SuperPoints”.

Submit Your Own

Do you have a code snippet you want to share with other myCRED users? Submit your Gist and earn Tokens.

Last edited October 22, 2016