Hack for sorting Badges?

AI-generated summary

Sorting Badges Hack: Lutz sought a hack to sort badges without adding more badge groups or patching the code. He found that by adding rows to the “badge_types” table and assigning lower IDs to desired badges, they can be sorted in a specific order within a badge group. This method allows for custom sorting of badges, as demonstrated by Lutz with an example of sorting badges from “Bronze” to “Diamond”.

Badges are becoming increasingly important on our pages. Is there a hack for sorting them, besides adding more badge groups? We have a lot of custom badges for xxx messages or xxx likes - so more groups are not really the way we want to go.

I’m open to any ideas, except patching the code - that’s currently going beyond my possibilities.

In case someone needs it, there is way to sort the badges inside a single Badge-Group.

You need to add more rows to the table “badge_types”. Lower Id’s will be sorted to the end of the list.
Lets say you need to sort 5 Badges in one Badge-Group (they are from the table badge_groupings). You could edit the table “badge_types” as follow:

  • row-id 1: name “Diamond”
  • row-id 2: name “Platin”
  • row-id 3: name “Gold”
  • row-id 4: name “Silver”
  • row-id 5: name “Bronze”

Then set your badges to the type you want. They will be displayed from Bronze → Diamond on the /badges and /users/[username]/badges page.

Hmmm curious what ended up happening here? What modifications did you make?