Criteria Builder

xF2 Add-on Criteria Builder 1.0.0

No permission to download
Compatible XF Versions
  1. 2.1
Additional Requirements
• PHP 7 and above
• XenForo 2.1.0 Beta 5 and above.
banner-png.190894

Description

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 :mad: 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
In short, Criteria Builder can do all listed above and even more.

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
Then you can support me on my Patreon!

___

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:

full_control_from_acp-png.190897



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:

importing_criteria_1-png.190904



Now, you need to select which criteria to import and which to upgrade:

importing_criteria_2-png.190905



You can also edit new criteria right on "Resolving" page:

importing_criteria_3-png.190906



Using criteria

When you imported (or created) some criteria, you can select it when creating a trophy/notice/user group promotion:

using_criteria-gif.190907



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:

creating_criterion_1-png.190898



After that, you can write a criterion PHP code right in ACP. No need to create .php files and place them in src folder:


creating_criterion_2-png.190899



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:

criterion_params_1-png.190900



Retrieving the parameter value using $get(_PARAM_NAME_) function:

criterion_params_2-png.190901



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

adding_param-gif.190902



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:

drag_and_drop-gif.190908



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
  1. Download the addon
  2. In admin control panel go to "Addons" section, click on "Install/upgrade from archive" and select downloaded addon archive
Importing basic criteria

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" category:
  • Bookmarks added
    • A number of bookmarks
Unistallation
  1. Uninstall the addon from ACP
  2. Go to forum root folder and remove src/addons/CMTV/CriteriaBuilder and js/CMTV/CriteriaBuilder folders.
That's it!
Author
Admin
Size
95.5 KB
Extension
zip
Downloads
10
Views
2,242
First release
Last update

More resources from Admin

Similar resources

API endpoint: Find a User by Criteria Admin
Adds an API endpoint to find a user by criteria: user_id, email, or username
PHP Criteria AnimeHaxor
PHP Criteria 1.0.0 Nulled
Powering up trophy/promotion system with custom PHP criteria!
Allows you to specific page criteria using when using Xon's Browser Detection addon.
[OzzModz] Page Criteria: Date Admin
Adds new page criteria depending on the current day of week or month
[OzzModz] User Criteria: Reacted Content Admin
ds new user criteria to check if the user left reactions on the required content
731Threads
2,287Messages
63,991Members
bropismateLatest member
Back