Shauny requested a feature to manually mark badges as “not grantable” for admin interfaces while retaining API grant capabilities, aiming to reduce clutter from automatically granted badges. Initially, JammyDodger suggested a workaround using impossible SQL logic (e.g., WHERE id = -1000) combined with an “Update Daily” trigger, which Shauny confirmed worked temporarily. However, Shauny later reported that a recent update broke this method, causing all badges to appear as grantable again regardless of the criteria. JammyDodger confirmed the workaround is no longer functional, citing a specific code change that addressed this behavior but failed to update the discussion thread.
I have loads of badges on my site which are automatically granted via the API when someone does something on the connected WordPress site. It works great!
However I have a few badges I need to manually grant on posts.
When I do this, allllll the badges I have set up appear in the “grantable badges” list which means lots of scrolling.
Is there a way to set a badge as being “not grantable” by admins, but keep it possible to grant via the API? That would help with management of badges.
I noticed that badges with SQL logic don’t appear in the list to grant, so is there a way for me to add some fake / impossible SQL logic to a badge so that it doesn’t appear in the list, but I can still grant with the API?
If you have the box to add some SQL then I think you can try to add some impossible-to-get criteria in there and see how you get on. It’s not really what it’s intended for, but it might work out for what you need.
Maybe something like:
SELECT id user_id, created_at granted_at
FROM users
WHERE id = -1000
Make sure auto-revoke isn’t set as well, as that would strip the manually granted ones too.