[WordPress] 外掛分享: WordPress MU Domain Mapping

前言介紹

  • 這款 WordPress 外掛「WordPress MU Domain Mapping」是 2008-08-10 上架。
  • 目前有 3000 個安裝啟用數。
  • 上一次更新是 2017-11-28,距離現在已有 2713 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 外掛最低要求 WordPress 3.1 以上版本才可以安裝。
  • 有 99 人給過評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

donncha | wpmuguru | automattic |

外掛標籤

multisite | wordpressmu | domain mapping |

內容簡介

這個外掛讓 WordPress MU 站點或 WordPress 3.0 網路的使用者將其部落格/網站映射到另一個域名。

它需要手動安裝,因為一個文件必須複製到 wp-content/。當升級插件時,請記得更新 domain_mapping.php 和 sunrise.php。完整的說明在安裝頁面上,並且相當容易遵循。您還應該閱讀此頁面。

超級管理員必須在 Super Admin->Domain Mapping 中配置插件。在此頁面上,您必須輸入您的服務器的 IP 或 IP 地址(逗號隔開)。這些地址僅用於文檔目的,以便用戶知道它們是什麼(以便用戶可以正確設置他們的 DNS)。它們在插件中並不起特殊作用,只是為了讓用戶看到而已。

您還可以在此頁面上定義 CNAME。它很可能是您網絡的域名。有一些限制和警告,請參閱下文。

您的用戶應該轉到工具->域名映射,其中他們可以添加或刪除域名。必須為一個域名設置為部落格的主要域名。當映射域名(如“example.com”)時,您的用戶必須在其 DNS 中創建一個指向該 IP 地址的 A 記錄。如果您的服務器使用多個 IP 地址,他們應該使用多個 A 記錄。

如果您的用戶正在映射域名的主機名(有時稱為“子域名”),例如 www.example.com 或 blog.example.com,則創建一個指向其部落格 URL(而不是 IP 地址)的 CNAME 記錄即可。

為了確保用戶在原始網絡和映射域名網絡上都已登錄,登錄頁幾乎總是會重定向回部落格的原始域名。出於安全原因,如果您允許用戶在映射域上使用其儀表板,則遠程登錄會被禁用。

超級管理員現在可以選擇允許用戶通過提供 IP(或 IP 地址列表)設置 DNS ANAME 記錄,或者只設置 CNAME,而不能兩者兼備(為最終用戶輸入 CNAME 會使 IP 的使用失效)。

有關使用 CNAME 和 ANAME 處理 DNS 的辯論很多,因此根據您的偏好和設置,兩種方法都可用。

請記住以下事項:

- 應避免指向其他 CNAME 記錄的 CNAME 記錄(RFC 1034 第 5.2.2 節),因此如果您的域名是 ANAME 到 IP 地址(或地址)的情況,只告訴最終用戶使用您選擇的域名作為其 CNAME DNS 輸入。
- 只在主要域名是 IP 地址的 ANAME 的情況下使用 CNAME 方法。這非常重要。您如何知道?檢查您的 DNS 或詢問您的主機公司。
- 讓最終用戶只使用您選擇的域名而不是 IP(或 IP 地址列表)作為其 CNAME 會使您的 WordPressMU 博客平台或 WordPress 3.0 網路更容易管理,例如購買/部署新服務器,或者添加更多使用循環式輪詢場景的服務器。您的最終用戶不需要擔心 IP 地址更改。
- 最後,要告訴最終用戶使用 ANAME IP 或 CNAME 域名是由您和您的系統部署決定的。
- 進一步閱讀:http://www.faqs.org/rfcs/rfc2219.html
- 為了本地化:將翻譯文件(即 wordpress-mu-domain-mapping-xx_XX.mo)放置在目錄 wp-content/plugins/wordpress-mu-domain-mapping/languages 中。您可能需要自己創建該目錄。

動作鉤:

現在,您可以鉤入 domain_mapping mu-plugin 的某些部分,以擴展內置功能而無需修改此插件。要做到這一點,只需在 mu-plugins 目錄中創建一個名為此插件之後的腳本。

原文外掛簡介

This plugin allows users of a WordPress MU site or WordPress 3.0 network to map their blog/site to another domain.
It requires manual installation as one file must be copied to wp-content/. When upgrading the plugin, remember to update domain_mapping.php and sunrise.php. Full instructions are on the Installation page and are quite easy to follow. You should also read this page too.
Super administrators must configure the plugin in Super Admin->Domain Mapping. You must enter the IP or IP addresses (comma deliminated) of your server on this page. The addresses are purely for documentation purposes so the user knows what they are (so users can set up their DNS correctly). They do nothing special in the plugin, they’re only printed for the user to see.
You may also define a CNAME on this page. It will most likely be the domain name of your network. See below for some restrictions and warnings.
Your users should go to Tools->Domain Mapping where they can add or delete domains. One domain must be set as the primary domain for the blog. When mapping a domain, (like ‘example.com’) your users must create an A record in their DNS pointing at that IP address. They should use multiple A records if your server uses more than one IP address.
If your user is mapping a hostname of a domain (sometimes called a “subdomain”) like www.example.com or blog.example.com it’s sufficient to create a CNAME record pointing at their blog url (NOT IP address).
The login page will almost always redirect back to the blog’s original domain for login to ensure the user is logged in on the original network as well as the domain mapped one. For security reasons remote login is disabled if you allow users to use their Dashboard on the mapped domain.
Super admins can now choose to either allow users to setup DNS ANAME records by supplying an IP (or list of IP addresses) or set a CNAME but not both (entering a CNAME for the end user voids the use of IP’s)
There is a lot of debate on the handling of DNS using CNAME and ANAME so both methods are available depending on your preference and setup.
Things to remember:

CNAME records that point to other CNAME records should be avoided (RFC 1034 section 5.2.2) so only tell your end users to use your chosen domain name as their CNAME DNS entry if your domain name is an ANAME to an IP address (or addresses)
Only use the CNAME method if your main domain is an ANAME of an IP address. This is very important. How do you know? Check your dns or ask your hosting company.
Giving your users the option to just use your chosen domain name and not an IP (or list of IP’s) to set as their CNAME will make administration of your WordPressMU blog platform or WordPress 3.0 network easier, an example of this would be purchasing/deploying a new server or indeed adding more servers to use in a round robin scenario. Your end users have no need to worry about IP address changes.
Finally, telling your end users to use an ANAME IP or CNAME domain name is up to you and how your systems are deployed.
Further Reading: http://www.faqs.org/rfcs/rfc2219.html
For localization: place translation files (ie. wordpress-mu-domain-mapping-xx_XX.mo) in the directory wp-content/plugins/wordpress-mu-domain-mapping/languages. You will probably have to create that directory yourself.

Action Hooks
You can now hook into certain parts of the domain_mapping mu-plugin to enable you to extend the features that are built in without the need to modify this plugin. To do this, just create a script within the mu-plugins dir that is called AFTER this plugin (eg, call it domain_mapping_extended.php).

dm_echo_updated_msg

This hook is for when you want to add extra messages for your end users when they update their settings, the current usage would be to remove the existing action and replace it with your own as shown within the example further down the page.

dm_handle_actions_init

Before we add our own handlers for our users wanting to update their mappings, we can use this action to maybe connect to your datacenter API ready for communication. An example would be to load an API class and connect before we send and recieve XML queries. Once again, see the example down the page. Your function can make use of the $domain variable.

dm_handle_actions_add

When an user adds a domain name to their mappings, this action can be used to perform other tasks on your server. An example would be to check the user has already set up the DNS records for the name to correctly point to your server. Your function can make use of the $domain variable.

dm_handle_actions_primary

This may or may not be commonly used in most cases but is there just in case. Your function can make use of the $domain variable.

dm_handle_actions_del

When an user deletes one of their domain mappings, this action can be used to reverse what dm_handle_actions_add has done. An example would be to remove the domain mapping from your server using your datacenter’s API. Your function can make use of the $domain variable.

dm_delete_blog_domain_mappings

If the blog is ever deleted and you make use of handle_actions, then this action will enable you to tidy up. An example would be when an user has set up multiple domain mappings and the blog is deleted, your function can remove any mess left behind. Your function can make use of the $domains array (numbered array of domains). NOTE, this will also be called if the user has no mappings, care should be taken in the case of an empty array.
EXAMPLE USAGE

$msg

";
}
// REMOVE THE ORIGINAL MESSAGES
remove_action('dm_echo_updated_msg','dm_echo_default_updated_msg');
// REPLACE WITH OUR OWN
add_action('dm_echo_updated_msg','dm_echo_extended_updated_msg');

// Prepare to use our Datacenter API

function dm_extended_handle_actions_init($domain) {
global $datacenter_api;
// There is a good chance we will be accessing the datacentre API
require_once(dirname(__FILE__) ."/classes/xmlAbstract.class.php");
require_once(dirname(__FILE__) ."/classes/xmlParserClass.php");
require_once(dirname(__FILE__) ."/classes/datacenterAPIClass.php");
$datacenter_api = new datacenter_api('MY_API_KEY', 'API_TYPE');
}
$datacenter_api = null;
add_action('dm_handle_actions_init', 'dm_extended_handle_actions_init');

// Check the users DNS is ready to go (we are using the CNAME option)
// then add the mapping to the datacenter API

function dm_extended_handle_actions_add($domain) {
global $datacenter_api;
// Check the domain has the correct CNAME/ANAME record
$dmip = gethostbyname(get_site_option( 'dm_cname' ));
$urip = gethostbyname($domain);
if ($dmip != $urip) {
wp_redirect( '?page=domainmapping&updated=dnslookup' );
exit;
}
$datacenter_api->add_mapping($domain);
}
add_action('dm_handle_actions_add', 'dm_extended_handle_actions_add');
?>

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「WordPress MU Domain Mapping」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


0.1 | 0.2 | 0.3 | 0.4 | 0.5 | 0.4.1 | 0.4.2 | 0.4.3 | 0.5.1 | 0.5.2 | 0.5.3 | 0.5.4 | 0.5.5 | trunk | 0.5.4.1 | 0.5.4.2 | 0.5.4.3 | 0.5.5.1 |

延伸相關外掛(你可能也想知道)

  • Gravatar Favicon 》這個外掛可以幫助你在網誌和管理頁面中建立一個 gravatar favicon 和包括 Apple touch icon 的管理員標誌。只要啟用這個外掛,它會自動將 gravatars 添加到你...。
  • WordPress MU Sitewide Tags Pages 》這個外掛可以在你的伺服器上為你的站點文章創建一個新的網誌,就像 http://wordpress.com/tags/ 一樣。, 基於效能考量,這裡會限制文章數量,且可以決定是否...。
  • WordPress Last Login 》這是一個非常簡單的外掛程式,提供有關您部落格帳戶上最後一次登錄活動的資訊。如果您擔心有人未經授權地訪問您的部落格帳戶,您可以使用此信息查明是否有人...。
  • Flare Smith 》FlareSmith 是一個外掛,用於將 FeedBurner 統計和 FeedFlare 服務整合到您的 WordPress 網站中,而且您不需要編輯任何佈景主題檔案!, 它作為內容篩檢器,會...。
  • WPMU Admin Interface Language 》這個外掛讓 WPMU 使用者可以在後臺管理面板中選擇語言。。
  • WDS Multisite Aggregate 》建立一個新的網站,在 WordPress 網路上收集所有最新的文章、頁面等(類似 http://wordpress.com/tags/)。, 考慮到效能的原因,文章數量限制為可配置的用戶...。
  • Multiple Twitter Widgets 》可顯示多個 Twitter 小工具。。
  • MU Post to Multiple Blogs 》此外掛在 WordPress 多站台中,創建了一個自訂欄位,讓你可以選擇要在哪些其他網誌發佈此篇文章。, , 網站管理員才能看到此自訂欄位。, , 為了效能考量,文章...。
  • Ada WPMS Sitewide Feed 》這個外掛程式可以從您的網站中所有的部落格,創建四(4)個不同的 RSS 2.0 訂閱:文章、留言、頁面和一個綜合的 [文章和頁面]。, 支援 WPMS 版本 4.9.20 以前...。
  • Multiple Penote Widgets 》此外掛可顯示多個 Penote 小工具。 Penote.com 為一社交網路服務,訂閱者可透過此服務發送短訊息或分享筆記給其他訂閱者。。
  • MU-Helpers 》這是一個 WordPress MU 或 BuddyPress 開發者專用的輔助工具外掛。目前提供兩個函數,分別是回傳所有部落格文章的函數和回傳所有部落格評論的函數。程式碼會...。
  • common_category 》這個外掛程式提供給 WordPress MU 管理員,可為所有部落格附加一個類別,但此外掛程式仍在測試中。, 待完成事項, 無事項。。
  • Ada Blogs Status 》此外掛添加了一個側邊欄部件,讓您可以顯示 WordPress 多站點(Multi-Site)/ WordPressMU 更新、新增或啟用的部落格。, 功能:, , 在三個標籤中顯示已更新、...。

文章
Filter
Apply Filters
Mastodon