- Compatible XF Versions
- 2.1
- Additional Requirements
- • PHP 7 and above
• XenForo 2.1.0 Beta 5 and above.
If you ever tried to create a trophy, you probably noticed "User criteria" tab. It allows you to set some conditions (number of posted messages, for example), which users must met to be awarded with your trophy.
There are some other systems that use XenForo's criteria system: notices when showing a banner, user group promotions.
The problem is that the amount of available criteria to choose from is too small and does not allow you to be creative. Here is just a small list of things you can't do with XenForo's criteria system:
- A "Collector" trophy for adding 100 bookmarks
- A "Hater" trophy for leaving 333 reactions
- Show a banner with "Thank you" text to users, who have replied 1000+ times in "Questions" forum
- Grant people with admin rights for creating 888 threads in "Off-topic" forum
- DESCRIBE_YOUR_DREAM_TROPHY_HERE
This addon allowes you to import/export criteria just as easy as importing/exporting smilies.
Did not found the criterion you wanted? Not a big problem. You can write your own without leaving ACP!
Your possibilities are limited only by your imagination!
This is an open source addon. Visit GitHub repository for source code.
All my addons are free...
But if you want to
- Be informed of all news about developing new addons
- Suggest and vote for new addons
- Try beta versions
- Receive 24-hour early access to new addons
___
Features
Full control from ACP
There is no need to create criteria somewhere outside an link them with inconvenient "Class/method callback".
You can import/export/create criteria from one place in admin control panel:
Importing criteria
Criteria can be imported from an .xml file. It can be a pack of criteria downloaded from this forum. Or maybe you just want to transfer criteria from one your forum to another.
First of all, you need to go to "Import" page and select the .xml file with criteria:
Now, you need to select which criteria to import and which to upgrade:
You can also edit new criteria right on "Resolving" page:
Using criteria
When you imported (or created) some criteria, you can select it when creating a trophy/notice/user group promotion:
Create custom criteria
If you are familiar with PHP you can create you own criteria.
First step is to fill the information about the criterion:
After that, you can write a criterion PHP code right in ACP. No need to create .php files and place them in src folder:
Criterion params
Imagine you want to create 3 trophies for adding 1, 15 and 50 bookmarks. Sounds like we need to create 3 similar criteria changing only one number: added bookmarks.... :cautious:
Fortunately, Criteria Builder allows you to create "criterion params" which values can be set when creating a trophy/notice and etc!
So you only need to create a "Bookmarks added" criterion with one parameter: the number of added bookmarks. You can than retrieve parameter value in criterion PHP code!
Criterion params list:
Retrieving the parameter value using $get(_PARAM_NAME_) function:
There are 8 built-in params in Criteria Builder (more can be added easily via addons):
- Text box (max length, icon, default value, username autocomplete and regex match)
- Number box (min and max values, default value, step)
- Switcher (enabled by default)
- Forum select (mulsti/single select)
- User group select (mulsti/single select)
- Thread prefix select
- Reaction select
- Date and time
Drag-and-drop sorting
Setting "display order" directly / having a separate "Sort" page - it is all in the past. You can just drag crieria, criteria categories and params and drop them at desired position:
Extendable
It is possible to create custom parameter defintions. It is as easy as creating a new widget definition. Just enable Development mode and create a definition at "Param definitions" page.
Moreover, you can listen CMTV_CB_criteria_types event to add your own criteria type support!
___
Installation
- Download the addon
- In admin control panel go to "Addons" section, click on "Install/upgrade from archive" and select downloaded addon archive
In the downloaded archive you can find a file called basic_criteria.xml. It contains 4 criteria to begin with. You can import them on "Import" page (see "Importing criteria" section above).
"Communication" category:
- Messages posted
- A number of messages
- Forums
- Visible/Deleted/Moderated
- Messages posted in thread
- Thread ID
- Visible/Deleted/Moderated
- Threads created
- A number of threads
- Forums
- Prefixes
- Visible/Deleted/Moderated
- Bookmarks added
- A number of bookmarks
- Uninstall the addon from ACP
- Go to forum root folder and remove src/addons/CMTV/CriteriaBuilder and js/CMTV/CriteriaBuilder folders.