[WordPress] 外掛分享: Force Admin Color Scheme

首頁外掛目錄 › Force Admin Color Scheme
WordPress 外掛 Force Admin Color Scheme 的封面圖片
600+
安裝啟用
★★★★★
5/5 分(2 則評價)
334 天前
最後更新
問題解決
WordPress 4.1+ v2.1 上架:2016-03-10

內容簡介

雖然通常是 WordPress 的個別設定,在某些情況下,強制將單一管理者配色方案強加於站點所有使用者上可能是必要的,例如:

為同一組用戶使用的多個網站提供獨特的後台配色方案,以增強網站之間的差異。
明確指示網站的產品和測試實例之間的後台差異。尤其是在此情況下,由於激活了相同的外掛並且經常存在相同的數據,很容易混淆實際上在哪個網站上。
強制使用與網站品牌相符的配色方案。
使用者個性表達在您的鐵腕之下被摧毀。

此外,該外掛還會從沒有設置全域管理顏色方案功能的使用者中刪除「管理顏色方案」設置。

連結:外掛首頁 | 外掛目錄頁面 | GitHub | 作者頁面

鉤子

該外掛通過一個過濾器進一步定制。通常,使用過濾器的代碼最好放入 mu-plugin 或特定於網站的插件中(此 readme 無法解釋)。

c2c_force_admin_color_scheme(過濾器)

「c2c_force_admin_color_scheme」過濾器允許您設置或覆蓋強制的管理員色彩方案。對該常數(“”)的使用優先於過濾後的值,但使用過濾後的值優先於通過管理員設置的值。

參數:

$color(字串):管理員配色方案的名稱。如果返回空字串,則該外掛將像未定義強制管理員配色方案一樣運作。

範例:

/**
* 根據使用者設置強制管理員配色方案。管理員獲得一種配色方案,而其他所有人都會獲得另一種。
*
* @param string $color 当前的强制管理员配色方案。空字符串表示没有强制管理员配色方案。
* @return string
*/
function my_c2c_force_admin_color_scheme( $color ) {
return current_user_can( 'manage_options' ) ? 'sunrise' : 'coffee';
}
add_filter( 'c2c_force_admin_color_scheme', 'my_c2c_force_admin_color_scheme' );

外掛標籤

開發者團隊

⬇ 下載最新版 (v2.1) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Force Admin Color Scheme」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

Though it is typically an individually configurable aspect of WordPress, there are times when forcing a single admin color scheme upon all users of a site can be warranted, such as to:

Provide a unique backend color scheme for multiple sites used by the same set of users to reinforce the difference between the sites.
Clearly denote backend differences between a production and staging/test instance of a site. Especially given that in this situation with the same plugins active and often the same data present, it can be easy to get mixed up about what site you’re actually on.
Force a site brand-appropriate color scheme.
Crush the expression of individuality under your iron fist.

Additionally, the plugin removes the “Admin Color Scheme” profile setting from users who don’t have the capability to set the admin color scheme globally since being able to set its value gives them the false impression that it may actually apply.
Links: Plugin Homepage | Plugin Directory Page | GitHub | Author Homepage
Hooks
The plugin is further customizable via one filter. Typically, code making use of filters should ideally be put into a mu-plugin or site-specific plugin (which is beyond the scope of this readme to explain).
c2c_force_admin_color_scheme (filter)
The ‘c2c_force_admin_color_scheme’ filter allows you to set or override the forced admin color scheme. Use of the constant (“) takes priority over the filtered value, but the filtered value takes priority over the value set via the admin.
Arguments:

$color (string): The name of the admin color scheme. If an empty string is returned, then the plugin will behave as if no forced admin color scheme has been defined.

Example:
/**
* Sets a forced admin color scheme based on user. Admins get one color scheme, whereas everyone else gets another.
*
* @param string $color The current forced admin color scheme. Empty string indicates no forced admin color scheme.
* @return string
*/
function my_c2c_force_admin_color_scheme( $color ) {
return current_user_can( 'manage_options' ) ? 'sunrise' : 'coffee';
}
add_filter( 'c2c_force_admin_color_scheme', 'my_c2c_force_admin_color_scheme' );

延伸相關外掛

文章
Filter
Apply Filters
Mastodon