Is there any way of telling how popular a Theme is?

You don’t really need to look at the users table here to display usernames. Data Explorer will automatically display avatars and username if the result of your query has a user_id column which the user_options table does have. :slight_smile:

Anyway, this topic got me personally interested so I spent a few minutes playing with data explorer and I got this little query which shows you user-selectable themes with the number of users using each theme:

WITH theme_stats AS (
    SELECT theme_ids[1] AS theme_id, COUNT(*)
    FROM user_options
    WHERE array_length(theme_ids, 1) <> 0
    GROUP BY theme_id
)

SELECT count AS "Number of users", themes.name AS "Theme name"
FROM theme_stats
JOIN themes
ON themes.id = theme_stats.theme_id
WHERE themes.user_selectable
ORDER BY "Number of users" DESC
18 Likes