enricodx I am not sure I understand what you mean.

You can add/remove achievements manually if you want, although it will only work for achievements that you set as Manual (the others will be added/removed when they are recalculated).

You can also set a minimum and maximum threshold for some achievements. The way I use this on my forum is something like this, for number of posts:

  • Beginner: from 0 to 49 posts
  • Intermediate: from 50 to 99 posts
  • Advanced: more than 100 posts

The achievements are removed when they go over the threshold and the next achievement will be given instead (with the notification). Is this what you mean?

    malago I mean simply remove an achievement at all. For example, I created a Test achievement and now I can't edit or remove it

      enricodx You can't? You can click on the achievement icon when you created it to edit and delete it. If you did not set an icon, just click above the name of the achievement in the list. It will load the modal again and you can modify it or delete it.

        malago

        when i click save i get an error (new achievements...the first)

        i can't see an ID, maybe is this the issue?

          malago

          alert: {type: "error", content: Array(1), controls: false}
          options: {method: "GET", url: "http://flarum.localhost/flarum/public/api/achievements", params: {…}, background: true, config: ƒ, …}
          response: null
          responseText: "<br />↵<b>Warning</b>:  Trying to access array offset on value of type null in <b>D:\xampp\htdocs\flarum\vendor\malago\flarum-achievements\src\Api\Serializers\AchievementSerializer.php</b> on line <b>47</b><br />↵<br />↵<b>Warning</b>:  Trying to access array offset on value of type null in <b>D:\xampp\htdocs\flarum\vendor\malago\flarum-achievements\src\Api\Serializers\AchievementSerializer.php</b> on line <b>47</b><br />↵<br />↵<b>Fatal error</b>:  Uncaught Laminas\HttpHandlerRunner\Exception\EmitterException: Output has been emitted previously; cannot emit response in D:\xampp\htdocs\flarum\vendor\laminas\laminas-httphandlerrunner\src\Exception\EmitterException.php:24↵Stack trace:↵#0 D:\xampp\htdocs\flarum\vendor\laminas\laminas-httphandlerrunner\src\Emitter\SapiEmitterTrait.php(40): Laminas\HttpHandlerRunner\Exception\EmitterException::forOutputSent()↵#1 D:\xampp\htdocs\flarum\vendor\laminas\laminas-httphandlerrunner\src\Emitter\SapiEmitter.php(27): Laminas\HttpHandlerRunner\Emitter\SapiEmitter-&gt;assertNoPreviousOutput()↵#2 D:\xampp\htdocs\flarum\vendor\laminas\laminas-httphandlerrunner\src\RequestHandlerRunner.php(98): Laminas\HttpHandlerRunner\Emitter\SapiEmitter-&gt;emit(Object(Flarum\Api\JsonApiResponse))↵#3 D:\xampp\htdocs\flarum\vendor\flarum\core\src\Http\Server.php(44): Laminas\HttpHandlerRunner\RequestHandlerRunner-&gt;run()↵#4 D:\xampp\htdocs\flarum\public\index.php(26): Flarum\Http\Server-&gt;listen()↵#5 {main}↵  thrown in <b>D:\xampp\htdocs\flarum\vendor\laminas\laminas-httphandlerrunner\src\Exception\EmitterException.php</b> on line <b>24</b><br />↵"
          status: 500
          xhr: XMLHttpRequest {readyState: 4, timeout: 0, withCredentials: false, abort: ƒ, onreadystatechange: ƒ, …}
          __proto__: Object

            Justoverclock That's a new one! Can you check your database to see if the flarum_achievements_user table has a column named new?

              Justoverclock So the table exists, but it is empty? If the structure matches the one I sent, it is correct...

              I can't reproduce this on my end so I will have to investigate more... It might be that the original migration was wrong and that messed up the tables? Maybe redoing the tables helps?

              CREATE TABLE `flarum_achievements` (
                `id` int(10) UNSIGNED NOT NULL,
                `name` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL,
                `description` text COLLATE utf8mb4_unicode_ci NOT NULL,
                `computation` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
                `points` int(11) NOT NULL,
                `image` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
                `rectangle` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
                `active` tinyint(1) NOT NULL DEFAULT '1'
              ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
              
              
              ALTER TABLE `flarum_achievements`
                ADD PRIMARY KEY (`id`);
              
              
              ALTER TABLE `flarum_achievements`
                MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
              
              CREATE TABLE `flarum_achievement_user` (
                `id` int(10) UNSIGNED NOT NULL,
                `user_id` int(10) UNSIGNED NOT NULL,
                `achievement_id` int(10) UNSIGNED NOT NULL,
                `created_at` timestamp NULL DEFAULT NULL,
                `updated_at` timestamp NULL DEFAULT NULL,
                `new` tinyint(1) NOT NULL DEFAULT '0'
              ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
              
              --
              -- Índices para tablas volcadas
              --
              
              --
              -- Indices de la tabla `flarum_achievement_user`
              --
              ALTER TABLE `flarum_achievement_user`
                ADD PRIMARY KEY (`id`),
                ADD KEY `flarum_achievement_user_user_id_achievement_id_index` (`user_id`,`achievement_id`),
                ADD KEY `flarum_achievement_user_achievement_id_foreign` (`achievement_id`);
              
              ALTER TABLE `flarum_achievement_user`
                MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
                
              ALTER TABLE `flarum_achievement_user`
                ADD CONSTRAINT `flarum_achievement_user_achievement_id_foreign` FOREIGN KEY (`achievement_id`) REFERENCES `flarum_achievements` (`id`) ON DELETE CASCADE,
                ADD CONSTRAINT `flarum_achievement_user_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `flarum_users` (`id`) ON DELETE CASCADE;
              COMMIT;

                malago ah, I just checked your commit history; curious to why you didn’t create a migration to update/make modifications to the table(s) instead?

                Version 0.1.3

                • Fixed a bug when posting new discussions. This is a temporary fix until I find a better way to do it, but it works 🙂
                • Fixed a bug when creating the first achievement

                Justoverclock Please check out this version and let me know if your error is fixed!

                I am getting close to be confident that the extension is stable. I really appreciate your reports and comments!

                Justoverclock Thanks for the feedback! I will add the italian translation and check the image.

                Can you tell me the url of the image and the size you are using?

                Also, where would you like the list and points to appear?

                I am adding the option to use font awesome icons to make it easier to use without external images too. I hope I can post it in a few days.

                  malago 64x64, hosted by imgbb maybe u can use the number like text (same as like/reply) on the same line

                    i don't understand why i've included the translation on my language pack, but not work @luceos

                    Justoverclock You are probably not using the image URL, it has to end in .jpg or .png

                    For instance, I am trying to upload something to ImgBB but I have to right click on the picture and get the URL of the image.

                    It is not https://ibb.co/y5gT6xw, it is: https://i.ibb.co/4M4y806/free-glyph-icons-1x-1.png

                    As for the translation... I have no clue why it does not work...

                    Also:

                    Version 0.2.1

                    • Added the option to use Font Awesome icons instead of an external image for the achievement icon. Use the icon code (e.g. far fa-comments) and it will understand that it is not a URL.
                    • Added two achievement examples in the README
                    • Solved a problem with the communication with the Middleware and the Listeners

                    Let me know if you find problems with this version.

                      malago i always used absolute image url 🙂 anyway i try this version tomorrow

                      p.s. the idea of fontawesome icon is amazing 🙂