Trust Levels

A Flarum extension.

  • Trust levels allow you to automatically manage group membership based on users' activity.
  • Each trust level defines criteria that must be met (e.g. discussions started, posts made, etc), and a group.
  • Users are automatically added to groups for all the trust levels that they qualify for when they log in.
  • Other extensions (or local extenders) can add their own "range drivers"

Inspired by Discourse's trust level system.

Please Note

  • Since these groups are managed automatically, we recommend maintaining a separate set of groups for trust levels.
  • If you delete a trust level, you should also delete the associated group; otherwise, users in that trust level will remain in that group.
  • To prevent errors, you cannot update a trust level's group after it has been created.
  • Any ranges left disabled will not be counted. If all ranges are disabled for a given trust level, ALL users will receive that level.
  • If a group is managed by multiple trust levels, the user will be added to the group as long as they are in at least one of the trust levels.

Extensibility

This extension is extremely flexible, and can be extended to add custom range drivers! If your extension or community has some custom metrics that are important for automatically managing groups, you can make a custom range driver by implementing Askvortsov\TrustLevels\Range\RangeDriverInterface, and registering that driver via the Askvortsov\TrustLevels\Extend\TrustLevel extender.

TODO:

  • Add support for more ranges:
    • Likes received
    • Posts read
    • Time spent on forum
    • Days visited
    • Days since account creation
    • Etc
  • Add support for dated ranges (discussions created in the past X days)
  • Develop a data collection extension, which could cache things such as like counts, to improve performance on large forums

Screenshots

Admin
Set Ranges
Edit User

Installation

composer require askvortsov/flarum-trust-levels

Updating

composer update askvortsov/flarum-trust-levels

Links

askvortsov changed the title to Trust Levels (Automatic Group Assignment) .

Is a good idea, congratulations!!!

I think is not working yet...
Error

    Have you installed it with composer, and are you using beta 15?

    Interesting extension. Where can the current trust level be seen for all other members?

      I get this error when I log in.

      POST http://localhost/public/login
      
      <br />
      <b>Notice</b>:  Array to string conversion in <b>C:\xampp\htdocs\vendor\askvortsov\flarum-trust-levels\src\TrustLevelCalculator.php</b> on line <b>63</b><br />
      <br />
      <b>Fatal error</b>:  Uncaught Laminas\HttpHandlerRunner\Exception\EmitterException: Output has been emitted previously; cannot emit response in C:\xampp\htdocs\vendor\laminas\laminas-httphandlerrunner\src\Exception\EmitterException.php:24
      Stack trace:
      #0 C:\xampp\htdocs\vendor\laminas\laminas-httphandlerrunner\src\Emitter\SapiEmitterTrait.php(40): Laminas\HttpHandlerRunner\Exception\EmitterException::forOutputSent()
      #1 C:\xampp\htdocs\vendor\laminas\laminas-httphandlerrunner\src\Emitter\SapiEmitter.php(27): Laminas\HttpHandlerRunner\Emitter\SapiEmitter-&gt;assertNoPreviousOutput()
      #2 C:\xampp\htdocs\vendor\laminas\laminas-httphandlerrunner\src\RequestHandlerRunner.php(98): Laminas\HttpHandlerRunner\Emitter\SapiEmitter-&gt;emit(Object(Laminas\Diactoros\Response\JsonResponse))
      #3 C:\xampp\htdocs\vendor\flarum\core\src\Http\Server.php(42): Laminas\HttpHandlerRunner\RequestHandlerRunner-&gt;run()
      #4 C:\xampp\htdocs\public\index.php(26): Flarum\Http\Server-&gt;listen()
      #5 {main}
        thrown in <b>C:\xampp\htdocs\vendor\laminas\laminas-httphandlerrunner\src\Exception\EmitterException.php</b> on line <b>24</b><br />

        ctml Thanks for the info 🙂 Working the extension with the Maria DB 10.4

        Alshain Fixed in v0.1.1, thanks for the report!

        To @everyone here, what metrics would you like to be supported for trust levels? I want to avoid adding too many to start as that can result in a clunky display, but what do you find important in deciding whether to automatically grant privileges to users?

          askvortsov Thank you for return.
          However, there is a problem like this.

          The member was formerly the moderator. When he meets the conditions during the transition to the new system, shouldn't his old status be deleted and only switch to the new status?
          As can be seen in the picture, when the member is added to a new group while he is a moderator, both are available 🙁

            askvortsov

            For me number of posts, number of discussions and likes will be the most useful basic metrics. I think number of read posts can also be quite interesting!

            mysql 5.7.32 can't use it. how can solve it ?

            • ctml replied to this.