أحاول تحديد عدد المستخدمين الذين يستخدمون إما السمة الداكنة أو السمة الفاتحة. لقد قمت بجمع هذا الكود لاستكشاف البيانات؛
/* السمة الفاتحة */
SELECT COUNT(*)
FROM user_options
WHERE theme_ids[1] = 6
بناءً على ما أستطيع استنتاجه، يتم تخزين معرف السمة في الحقل theme_ids وفي عنصر المصفوفة 1. هل يمكن لأحدكم تأكيد ذلك؟
في إعداداتنا، تظهر السمة الداكنة كقيمة 7، بينما تظهر السمة الفاتحة كقيمة 6.
ومع ذلك، عند تشغيل الاستعلامات، أحصل على 140 شخصًا يستخدمون السمة الداكنة و32 شخصًا يستخدمون السمة الفاتحة. وبما أن لدينا عدة آلاف من المستخدمين، يبدو هذا الرقم منخفضًا جدًا، لذا أعتقد أن استعلامي المجمع إما خاطئ — أو — هل تُخزن هذه القيم فقط للمستخدمين الذين قاموا بتعيين سمة بشكل محدد، بينما لا يتم تخزين هذه البيانات إذا كانوا يستخدمون السمة الافتراضية؟
Many thanks for the link, and the swift response! I’m pleased to see that I was looking at the right fields.
Just to confirm, is the data that is returned for only the users that have specifically set their theme, e.g. any users who haven’t set it wouldn’t be returned in the data set, so we could just assume that they are using the default theme?
Perfectly fine if this is the case, just want the clarification please
I checked with @Osama and indeed, the query would only show those who’ve set a theme in their preferences that’s different from the default on your site.
It also includes those who’ve changed back to the default theme after choosing some other non-default theme.
For all intents and purposes, all users that the query returns that use the default theme + any users that don’t show up can be counted as users that use the default theme.
The query will also return a breakdown of the number of users that chose any other user-selectable themes on your site.
Awesome, many thanks for the confirmation and info and thanks for @Osama who’s query looks better than mine - albeit I got the same results - but I’ll pinch that one