Updating tier slug

I’m self hosting on DO version 5.69.3

If you are logged on a browser as admin and visit, /ghost/api/admin/tiers/ one sees the list of membership tiers. Here’s a typical entry:

      "id": "64c4111a58880218ae05ba38",
      "name": "SUBSCRIBER",
      "description": "Full access to premium content & forums",
      "slug": "default-product",
      "active": false,
      "type": "paid",
      "welcome_page_url": null,
      "created_at": "2023-07-28T19:03:54.000Z",
      "updated_at": "2023-07-28T19:05:11.000Z",
      "visibility": "none",
      "benefits": [
        "Everything in Free, plus...",
        "Access to subscriber-only content",
        "Join our community to create post & comment in the forum",
        "Support the world's oldest surfboard design forum"
      "currency": "USD",
      "monthly_price": 500,
      "yearly_price": 5000,
      "trial_days": 0

For reasons too long to explain, I’m interested in changing the slug name of a membership tier. There’s no way to do this via the UI, so I tried doing it editing it directly in the database. I’m assuming the correct table is products

for example:

mysql> select id, name, slug from products where slug = "default-product";
| id                       | name       | slug            |
| 64c4111a58880218ae05ba38 | SUBSCRIBER | default-product |
1 row in set (0.00 sec)

mysql> update products set slug = "subscriber" where name = "SUBSCRIBER";
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select id, name, slug from products where name = "SUBSCRIBER";
| id                       | name       | slug       |
| 64c4111a58880218ae05ba38 | SUBSCRIBER | subscriber |
1 row in set (0.00 sec)

This is all good and fine, however, when I pull up the api endpoint again, the slug name change is not reflected.

What am I doing wrong?

Have you tried restarting Ghost after modifying the database? There might be some caching in place :sweat_smile:

ha ha. Funny you picked up on this @vikaspotluri123 cause the problem I’m trying to solve is related to Discourse on Ghost. Specifically, I’m trying to change the name of a Ghost Tier and have it reflected over on Discourse.

I’ll try your suggestion and get back to you, but in the meantime, here’s what I’m seeing.

It seems on Discourse I can change the “name” of the tier/group, but they have a “full_name” which is not changable and gets locked with the tier over on Ghost.

<div class="group-info-names">
    <span class="group-info-name">Craftsman</span>  // changeable
    <div class="group-info-full-name">tier_supporter</div> // not changeable

If I can’t change the slug/full_name under the hood, i think I can archive a tier/group and create a new one with the naming structure I want.

I was worried about doing this, because I already have around 30 users in the tier with the name I want to change…

Make sense?

Hah, that was my guess :joy: I get what you’re saying - unfortunately Discourse doesn’t have a group “slug” (they use the group name as a public ID), and DoG (intentionally) doesn’t have a database, so the only way to map Tiers to Groups is by maintaining the same slug

So, I’m assuming that if I manage the modify the slug over on Ghost and run the DoG node-first-run.js, then a new group should be rendered over on Discourse?

Obviously, not holding you to any of this… :stuck_out_tongue_winking_eye:

Restarting ghost made the db change show up in API. :man_shrugging:

1 Like

I think so! I don’t know that the old group (default-product) will be migrated over, so you might have to add all the members in the old group into the new group that’s created