fix(products): plan editor pins Customer Role to resolved default, overriding global Default Role

Đã đóng
#2,081 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Một pull request liên quan đã được merge.

  • #2082 của @superdav42 — đã merge

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
php, wordpress
Lĩnh vực
backend

Hướng nghiên cứu

Read inc/admin-pages/class-product-edit-admin-page.php around line 757 and inc/limitations/class-limit-customer-user-role.php around line 74 to understand how the plan editor gets the customer role. The issue describes the fix: show the stored value, falling back to default; check that saving an untouched plan preserves default and that existing explicit roles remain visible. Pull request #2082 is already open against this issue.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug origin:interactive status:available

Problem

Customer reports that with Settings → Login & Registration → Default Role set to a custom role ("CRM Admin"), new customers are still added to their site as Administrator.

Root cause

The plan editor's Customer Role select (inc/admin-pages/class-product-edit-admin-page.php:757) uses Product::get_customer_role(), which resolves an unset/default limit to the current global default_role (inc/limitations/class-limit-customer-user-role.php:74). So "Use Ultimate Multisite default" is never shown as selected; the select shows the resolved role (administrator out of the box). Saving the plan then stores that role explicitly, and Site::save() (inc/models/class-site.php:2238-2241) prefers the plan's role over the global setting from then on. Changing Default Role later has no effect on that plan.

Fix

Show the stored value in the editor, falling back to default, so saving a plan without touching the field keeps following the global setting.

Verification

Dev network, global Default Role later switched to WooCommerce shop_manager, site cloned from template via pending-site publish:

  • Plan saved with the old editor value → stored administrator → customer gets administrator.
  • Plan saved with the patched editor value → stored default → customer gets shop_manager.

Existing plans that already have an explicit role keep it; the editor now displays it so admins can switch to "Use Ultimate Multisite default".

Ngôn ngữ chính
PHP
Star
218
Fork
88
Merge trung bình
1 ngày 5 giờ
Pull request đã merge (30 ngày)
94

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Ultimate-Multisite/ultimate-multisite

Tất cả issue của Ultimate-Multisite/ultimate-multisite

Issue tương tự

Thêm issue về PHP

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.