# Unstar all badges

**URL:** https://meta.discourse.org/t/unstar-all-badges/344167
**Category:** Theme component
**Tags:** badges, end-of-life
**Created:** [December 24, 2024, 9:24am UTC](https://meta.discourse.org/t/unstar-all-badges/344167 "2024-12-24T09:24:37Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![NateDhaliwal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/natedhaliwal/32/313494_2.png) [@NateDhaliwal](https://meta.discourse.org/u/NateDhaliwal)
#### Post date: [December 24, 2024, 9:24am UTC](https://meta.discourse.org/t/unstar-all-badges/344167/1 "2024-12-24T09:24:37Z")

</div>

| | | |
| --- | --- | --- |
| ℹ | **Summary** | Unstars all favourited badges |
| 👓 | **Preview** | [https://discourse.theme-creator.io/theme/NateDhaliwal/unstar-all-badges](https://discourse.theme-creator.io/theme/NateDhaliwal/unstar-all-badges) |
| 🛠 | **Repository** | [GitHub - NateDhaliwal/Unstar-all-badges · GitHub](https://github.com/NateDhaliwal/Unstar-all-badges) |
| ❓ | **Install Guide** | [How to install a theme or theme component](https://meta.discourse.org/t/how-do-i-install-a-theme-or-theme-component/63682) |
| 📖 | **New to Discourse Themes?** | [Beginner’s guide to using Discourse Themes](https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966) |

Install this theme component

After reading [this topic](https://meta.discourse.org/t/failed-error-when-trying-to-un-star-the-bug-reporter-badge/330523), I realised that it may not be very easy for users to open the console, especially on mobile. To help that, I made a simple Theme Component to do this.

 ![The image is a screenshot of a user profile on a social or discussion platform, featuring the user "NateDhaliwal" with three badges awarded, including Basic, Enthusiast, and First Like, with options to expand or message the user. (Captioned by AI)](https://global.discourse-cdn.com/meta/original/4X/6/6/8/6688189336f69953bb72c211094ade6e0a0f4243.png)

Then once the button is clicked:

 ![The image shows a user profile page on a website with badges indicating levels of achievement in various categories such as basic, enthusiast, and first like. (Captioned by AI)](https://global.discourse-cdn.com/meta/original/4X/0/0/2/002033247abeb43f6b585c03d850346ad35fa340.png)

* * *

I used the code here:

> [@'FAILED' error when trying to un-star the 'Bug Reporter' badge](https://meta.discourse.org/t/failed-error-when-trying-to-un-star-the-bug-reporter-badge/330523/4):
>
> ```js
> const user_name = require("discourse/models/user").default.current().username;
> const badges = await require("discourse/models/user-badge").default.findByUsername(user_name);
> const favorites = new Map();
> badges.filter((b)=>b.is_favorite).forEach((b)=>favorites.set(b.badge_id,b));
> favorites.forEach((b)=>b.favorite());
> 
> ```

to make this component.

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [October 25, 2025, 9:55pm UTC](https://meta.discourse.org/t/unstar-all-badges/344167/2 "2025-10-25T21:55:16Z")

</div>

I think the bug was fixed, so hopefully the component is no longer needed.

> [@'FAILED' error when trying to un-star the 'Bug Reporter' badge](https://meta.discourse.org/t/failed-error-when-trying-to-un-star-the-bug-reporter-badge/330523/8):
>
> I’ve created a pr to fix this issue: [https://github.com/discourse/discourse/pull/32369](https://github.com/discourse/discourse/pull/32369)

---

<div class="post-metadata">

### Author: ![NateDhaliwal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/natedhaliwal/32/313494_2.png) [@NateDhaliwal](https://meta.discourse.org/u/NateDhaliwal)
#### Post date: [October 25, 2025, 10:54pm UTC](https://meta.discourse.org/t/unstar-all-badges/344167/3 "2025-10-25T22:54:16Z")

</div>

Going to add a #end-of-life on this.
