Coming to 1.7 – Beta now available

Home / Blog / Coming to 1.7 – Beta now available

After considerable delay, the 1.7 beta is now available for download! This version comes with tons of new features and under the hood improvements.

In this article I will walk through some of the new features coming to myCRED 1.7 and welcome you to help me beta test. Beta testing will help make sure we squash as many bugs as possible before it’s official launch in early May.


Version 1.7 requires WordPress 4.0 or higher!


Sell Content Add-on

Multiple point types, new shortcodes and improved settings.

Screenshot showing how the sell content shortcodes are presented when using Visual Composer.

Multiple Point Types

The Sell Content add-on has been completely re-written in order to allow content sales using multiple point types and not just one particular type. Users are automatically presented with the payment options they can afford allowing them to choose which point type to pay with.

Support for sales of large number of contents

Up until now, you would need to set posts for sale one by one, or use a custom code snippet to enable sales of multiple posts. In 1.7, the add-on has a new feature enabling you to set content for sale by default! You can select which post type you want to sell and it also has a filter that allows you to for example set all content in a particular category for sale automatically.

Administrators can of course still override this on a post by post basis or even change the price.

The Sell Content add-on's settings has been updated to add support for multiple point types and setting content for sale by default.
Example where we sell parts of a content using the mycred_sell_this shortcode. You can also see the three new shortcodes as examples.

No more AJAX option - just AJAX

As of version 1.7, all content sales will be handled using AJAX. This means that the mycred_sell_this_ajax shortcode is no longer needed. Instead, the add-on now only uses the mycred_sell_this shortcode if you want to sell access only to parts of your content. As before, the shortcode usage is not mandatory, you can still sell the entire content field.

New Shortcodes

The new add-on has also received a few new shortcodes:

  • mycred_content_sale_count – Shows the number of times the content has been sold.
  • mycred_content_buyer_count – Shows the number of distinct users that has purchased the content.
  • mycred_content_buyer_avatars – Shows a list of avatars of the users that has purchased the content.
buyCRED Add-on

New Bank Transfer Gateway and updated pending payments.

The pending payment editor has been updated to make management easier.

Manual Gateway

The buyCRED add-on has received a new “manual” payment gateway called “Bank Transfer”. You can rename the gateway and use it for check or other form of manual payments.

Pending Payments Editor

The pending payments editor has received a face-lift and I have removed anything not relevant to each order.

The settings for the bank transfer gateway.
Badges Add-on

New badge editor interface and multiple requirements.

When updating to 1.7, you will need to go and edit each badge you have created in previous versions and make sure the settings are correct. Even if they are, you are recommended to save anyways.

Multiple Requirements

The badges add-on has been re-written to add support for multiple requirements! Old badges are automatically updated and you can add more requirements for each badge and badge level if you prefer.

You are no longer limited to use one particular point type / reference or calculation but instead combine multiple items at will.

New Badge Editor

In order to add support for multiple requirements, I had to re-write and re-design the badge editor. It is now in-line with other myCRED edit screens and follows the same over all design.

Example showing how you can now set multiple requirements for earning badges.
Bootstrap Support

Better styling support.

Example showing how bootstrap can help style myCRED shortcodes. In this example the mycred_transfer shortcode.

Version 1.7 comes with full Bootstrap support. All widgets and shortcodes have been updated to render elements that Boostrap will style for you. I have also updated CSS classes and ids to help you further customize your installations look and feel.

New Experimental Admin UI

Attempt to make myCRED easier to manage and understand.

Add-ons are managed just like themes.
The user editor screen has been updated to show balances, badges and overrides without the need of tabs.

When Editing Users

The user editor screen has been updated and I have removed the use of the tabs. Instead, balances, badges and ranks are all shown on the same page using the styling WordPress provides for other items on the same page.

Balance Editor

The balance editor has also received a facelift. I have also added in an option for you to view a users recent points history right in the editor.

Just as in earlier versions, you can access the editor on the Users page in your wp-admin area. If you use multiple point types, you can edit each point type balance individually.

New in 1.7 is the option to add a log entry with a reference. Before all manual edits has been logged under a unique reference. But now you can give points for other instances.

Edit a users balance and view their recent history.

Hooks Management

The biggest management change comes with the Hooks module. Based on the widgets management setup in WordPress, hooks are now enabled by dragging them into the “Active Hooks” sidebar. Once a hook is dragged into this sidebar, it is automatically activated.

I consider this change experimental and it’s future depends on your feedback. If it makes hook management easier it will stay. I am hoping that this will help slim down the learning curve for users new to myCRED Hooks.

Note that the feature “Hooks based on roles” has not been included in this version. In order to allow hooks to be managed based on a users role, most, if not all, hooks must be re-written. Until I have found a way that can make this transition either easy or better, unnecessary, the feature will not be included. I do aim to have this sorted out during the 1.7 lifespan.

Hooks are now managed just like Widgets in WordPress. Just drag a hook over to activate or drag back to deactivate.
The myCRED Log

Improved editor, filters and column options.

You can now select which columns you want to see in the log and filter by date.

Column Selection

You can now select which columns you want to show or hide when viewing the admin log under “Screen Options”. Any custom columns that you might have added in previous versions should still work with the new setup.

Improved Filters

The filtering options for the log has been improved. You can filter by reference, users numeric ID, username or email and you can select to filter the log by a specific date. While hovering your mouse over a log entry, the Date column will offer you a new option called “Filter by Date”. Clicking on this link will show entries only for that same day. You can also now simply filter by a specific user amongst the user entries.

Log Editor

When editing a log entry, you can change the amount, reference and log entry.

The log editor has been updated to allow you to change the amount and reference as well as the entry field.

Just as before, you can edit log entries in your admin area when viewing the log for any particular point type.

Changing the point amount in the log will not adjust a users current balance. Since you are editing the record of a past event, your change will only affect a users total balance.

Exporting

Better control over who can export and added option of allowing front end exports.

I have added the option for you to enable / disabled front-end or back-end exports of log entries. You can export entries in two formats:

  • Raw – Ideal for backups or if you intend to import the log somewhere else. Entries are exported exactly as they are stored in your database.
  • Formatted – Formatted exports will parse the log entry for any template tag you might be using and will only show the columns: Date, Reference, Amount (Points name), Point Type and the Entry.

Bulk Options

The log now also provides bulk options allowing you to select multiple log entries to delete or export.

Log Table Formatting

I have fixed a few styling bugs with the log table, including for example the navigation bar. With added Bootstrap support the table also renders much nicer without any added CSS.

New Shortcodes

The new mycred_show_if and mycred_hide_if shortcodes allows you to hide or show content based on the balance of the user viewing the content.

The new mycred_show_if shortcode in use.

The new mycred_total_since shortcode allows you to show the total number of points a user has gained since a specific date.

Other Improvements & News

If enabled, you can now let users export their log entries.
  • Compatible with WordPress 4.5
  • Compatible with PHP7
  • Added animation when a balance is updated in the admin area.
  • Brand New and simplified setup.
  • The transfer widget now supports the same attributes as the mycred_transfer shortcode.
  • New export tool and settings.
  • Added option to set a point type for the minimum or maximum balance requirements for coupons. Also enabled scheduling for coupons.
  • The mycred_link shortcode now supports using shortcodes in the title.
  • The BuddyPress hook now supports rewarding points for updating cover image and adding an update to your favorites.
  • Added options for Statistics add-on to set the colors used for each point type.

Featured that did not make the cut

A few features will not be introduced as promised with 1.7 but instead been pushed forward:

JSON API – I have made progress on this but have still a fair bit of work to do. I do not want to postpone the 1.7 launch just because of this so instead, this feature will be introduced during the 1.7 lifespan.

Hooks by Role – I do have a nice concept that would work nicely with the new Hook management layout to allow you to set hooks based on a users role. You could enable certain hooks for one role but not for another for example. This however poses a big issue – how to store this information without or with limited need to change existing hooks. Over the years I have written a lot of hooks and right now it seems we will need to update them all to add support for this.

Updates under the hood

In this section I have put together some information about some of the changes made to myCRED. It’s intended for those who have built custom add-ons or customizations in general for myCRED.

File Restructuring

Several add-ons and some of the core files have been re-structured.

Add-ons have to been adjusted to use the same folder and file naming structure as the core files. Where possible, shortcodes for example have been moved from the module classes to a dedicated shortcode file in a “includes” folder.

The myCRED_Query_Log class has been moved from the mycred-log.php file to class.query-log.php located in mycred/includes/classes/. The new myCRED_Query_Export class also resides in this folder.

Screen ID Change

While trying to implement the “Hide Columns” feature for the log archive, I discovered that my usage of capital letters in the url was the only thing standing in my way. If I used lowercase letters, WordPress could handle the checkbox selections for us. So, all myCRED screen IDs have been updated to use lowercase.

If you have added a sub menu to the myCRED menu or any custom point type menu, you must update your parent screen ID when registering the menu to use lowercase. All you have to do is replace “myCRED” with “mycred” in any screen IDs yo might use.

New Constants

In 1.7, I have added two new constants that you can use:

  • MYCRED_DEFAULT_TYPE_KEY – Allows you to change the default point type meta key from “mycred_default” to something else. Of course this works best if you add this to your wp-config.php file before you install myCRED but if you change / set this after you have installed myCRED, your users existing balance will disappear. If this is fine by you, I recommend you delete your users balances first to keep your database clean.
  • MYCRED_DEFAULT_LABEL – This constant sets the plugins name. Just like you can use the mycred_label filter to change the myCRED name, you can now also just use this constant.

Custom Log Columns

If you have added in custom log columns, please let me know if your columns are compatible with the new “Hide Columns” feature via the Screen Options tab. I have kept the old filters and variables in-place to add as much backward compatibility as possible.

New Export Class

In previous versions, the export of log entries were kind of tied in with the Log Query Class. As of version 1.7, a new dedicated export class has been added called myCRED_Query_Export. This class was built for rendering either raw or formatted exports to CSV files.

It has for methods you can use to get data from the log for export:

  • get_data_by_id() – retrieves log entries based of their ID.
  • get_data_by_user() – retrieves log entries based on a user.
  • get_data_by_type() – retrieves log entries based on a point type.
  • get_data_by_query() – retrieves log entries based on a query. This method uses the myCRED_Query_Log class so the arguments you pass to this method is passed on to this class.

Right now the documentation for this class is missing but this will be added to the codex. To give you a quick example, here is how you would request to export log entries for a given user:

$user_id = 1;
$args    = array( 'raw' => true );

$export = new myCRED_Query_Export( $args );
$export->get_data_by_user( $user_id );
$export->set_export_file_name( 'my-points-export.csv' );
$export->do_export();

First we construct the exporter. The constructor accepts two variables: First an array of arguments and optionally an array of the column headers to use for the csv file.

The arguments you can pass on are:

  • raw (bool) – If the export should be done RAW.
  • number (int) – The number of log entries to export. Defaults to all.
  • order (string) – The log column to order the results by. Defaults to time.
  • orderby (string) – The order. Either ASC for ascending or DESC for descending. Defaults to DESC.
  • date_format (string) – Option to set the date format to be used. Defaults to the format you selected in your General WordPress settings.

Next you need to get the data to export. You need to use one of the 4 methods mentioned above.

Next, you need to set the file name for the export file.

Finally you use do_export() which will render the export IF any data was found.

Export Functions

A few new functions has been added to make exports easier. You can find these in teh class.query-export.php file. An example is the new mycred_get_export_url() function. This function can allow you to generate a valid export URL which the export module will understand and act upon. The function requires you to set two variables:

  • $set – A string representing what you want to export with the link that the function generates. You can use user which will export the current users entries, search to export search results when filtering the log archive or all for exporting all log entries. You can also add your own identifiers using the mycred_log_exports filter.
  • $raw – A boolean value for raw or formatted exports.

Remove Personal History in wp-admin area

The new mycred_admin_show_history_{$point_type} filter allows you to remove the personal log history page under “Users” in your wp-admin area.

Removing this page also removes the link in the toolbar (if you use it).

Example of removing the default point type screen:

add_filer( 'mycred_admin_show_history_mycred_default', '__return_false' );

The myCRED_Account Class

As part of the coming support for the new JSON API, the myCRED_Account class handles the construction of the current users myCRED “account”. Just like using wp_get_current_user() returns the current user object, the new mycred_get_account function will return the current users myCRED object.

As the development of the JSON API progresses so will the information and documentation for this class. But you can if you are curious checkout the object alreayd now using something like:

$user_id = 1;
$mycred_account = mycred_get_account( $user_id );
echo '<pre>' . print_r( $mycred_account, true ) . '</pre>';

Basically we are constructing different objects that the function combines based on the user ID you provide. Some of the objects are:

  • myCRED_Account object – a parent object that contains the users information
  • myCRED_Balance object – contains information about the balance, such as the balance value, type and formatting.
  • myCRED_Point_Type object – contains information about a given point type.
  • myCRED_Badge object – contains information about a given badge.

As development progresses more objects will be added like one for ranks and transfers or content sales.

It is not recommended that you use the beta on a live site as it is expected to have bugs. If you do, make sure you have a copy of 1.6.9 at hand and backup your database!

None of the premium add-ons in the store currently support the new features in myCRED 1.7. Once 1.7 has been launched, all plugins effected will get an update! An example is the myCRED for Visual Composer add-on which currently does not support any of the new shortcodes!

Beta Testing

Everyone is welcome to help beta test version 1.7. Just like reporting bugs with the live version, you are also rewarded with Tokens for reporting bugs in the beta. If you suspect you found a bug, you can post it in the Beta Forum. Before you post your finding, please make sure you look through the forum to make sure it has not already been reported. Remember that you get extra Tokens for providing solutions as well.

Download Beta

You can download the beta directly from the mycred.me website. No betas are posted to the WordPress repository!

Because of this, the beta version of the plugin contains an update script that calls back to this website to check for updates instead of WordPress. This script will NOT be in the final release!

Last edited April 28, 2016

  1. Wow, this is amazing. I’m looking forward for the stable release 🙂
    Many thanks for your great plugin.

  2. currently using the beta,
    i love how “Hooks” are now displayed very similar to wordpress “widgets”.
    i love how “add ons” are now displayed very similar to wordpress “themes”
    very intuitive !!!
    “myCRED Statistics” now seems to finally work fine with php 7
    GREAT JOB so far !!!
    keep up the GREAT WORK !!!

Comments are closed.