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

クローズ
#2,081 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

関連するプルリクエストがすでにマージされています。

  • #2082 @superdav42 による — マージ済み

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
php, wordpress
領域
backend

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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".

主要言語
PHP
スター
218
フォーク
88
平均マージ
1日 5時間
マージ済み PR(30日)
94

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Ultimate-Multisite/ultimate-multisite のほかの issue

Ultimate-Multisite/ultimate-multisite の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。