simon
10 أكتوبر 2023، 8:48م
1
بالنظر إلى البرنامج النصي “إضافة مستخدم إلى مجموعة من خلال حقل مخصص للمستخدم”، يبدو أن هناك مشكلة بسيطة. إذا تم تحديد مشغل “تسجيل دخول المستخدم لأول مرة”، فيجب تعيين حقل إدخال “اسم حقل المستخدم المخصص” إلى اسم حقل المستخدم، على سبيل المثال “اللغة الأصلية”. ولكن إذا تم تحديد مشغل “متكرر”، فيجب تعيين حقل إدخال “اسم حقل المستخدم المخصص” بناءً على id حقل المستخدم. على سبيل المثال “user_field_5”.
التفاصيل حول كيفية العثور على الاسم عند استخدام المشغل “المتكرر” موجودة هنا: Finding Userfield Custom Name for 'Add user to group through User Custom Field' - #2 by leonardo .
من الناحية المثالية، سيتم استخدام الاسم الودي (على سبيل المثال “اللغة الأصلية”) كقيمة صحيحة لكلا المشغلين المتاحين. الكود ذو الصلة موجود هنا: https://github.com/discourse/discourse-automation/blob/main/lib/discourse_automation/scripts/add_user_to_group_through_custom_field.rb . الطريقة التي يجد بها مشغل “تسجيل دخول المستخدم لأول مرة” حقل المستخدم المخصص الصحيح من اسم الحقل (بدلاً من id) موجودة هنا:
https://github.com/discourse/discourse-automation/blob/main/lib/discourse_automation/scripts/add_user_to_group_through_custom_field.rb#L54-L67
ربما تكون هناك طريقة متوافقة مع الإصدارات السابقة يمكن تطبيق هذا المنطق بها على المشغل “المتكرر”.
3 إعجابات
للتوضيح، تم ذكر هذا في الدليل:
يشرح هذا الدليل كيفية إضافة المستخدمين تلقائيًا إلى المجموعات بناءً على اختيارهم لحقل مستخدم مخصص أثناء التسجيل أو تحديث الملف الشخصي.
مستوى المستخدم المطلوب: مسؤول
الملخص
إنشاء المجموعات اللازمة
إعداد حقل مستخدم مخصص
إنشاء أتمتة لإضافة المستخدمين إلى المجموعات
اختبار الإعداد
إنشاء المجموعات
أولاً، قم بإنشاء المجموعات التي تريد إضافة المستخدمين إليها تلقائيًا:
انتقل إلى منطقة المسؤول (Admin area) في موقعك
انتقل إلى “المجموعات” (Groups) في الشريط الجانبي ل…
لقد ذكرت إعادة العمل على البرنامج النصي لتحقيق الاتساق، على الرغم من أنه لم يتم تحديد أولوياته بعد. هناك أيضًا إعدادات المسؤول public user custom fields و staff user custom fields التي سيكون من الجيد مواءمتها معها أيضًا.
(وهناك أيضًا poll groupable user fields، والذي يستخدم “الاسم الودي”)
4 إعجابات
simon
11 أكتوبر 2023، 1:09ص
4
إليك طلب سحب لإصلاح المشكلة:
main ← scossar:feature-allow-either-user-field-name-or-user-custom-field-name-for-input
opened 01:07AM - 11 Oct 23 UTC
Currently the `add_user_to_group_through_custom_field` script expects the UserCu… stomField name to be used when the automation is triggered with the "Recurring" trigger, and the UserField name to be used when the automation is triggered by the "User first logged in" trigger. This is confusing for users. For both triggers, it would be better if the UserField name could be used. That's the name that is displayed on the Admin / Customize / User Fields page.
This PR attempts to fix the issue in a backwards compatible way, so that existing automations that are making use of the UserCustomField name (for example: 'user_field_5') will not be broken.
The PR also updates the "with one matching user" test to set the UserCustomField name in the way that Discourse sets the name - based on the UserField's id.
Related discussion on Meta: https://meta.discourse.org/t/add-user-to-group-script-has-different-field-input-for-the-two-triggers/281813
إعجابَين (2)
تم حل هذا الآن باستخدام قائمة منسدلة جديدة لتحديد حقول المستخدم المخصصة الموجودة لديك، والتي تعمل لكل من المشغلات:
committed 11:57PM - 26 Oct 23 UTC
New field to select user custom field. In addition, `add_user_to_group_through_c… ustom_field` script was adjusted to use the new component.
Also, data were migrated. Before they were not consistent.
Recurring script accepted text value which was user field identifier like `user_field_1`.
First logged in accepted text value which was user field name like `Title`.
إعجابَين (2)