[WordPress] 外掛分享: Restrict Usernames

WordPress 外掛 Restrict Usernames 的封面圖片。

前言介紹

  • 這款 WordPress 外掛「Restrict Usernames」是 2009-07-28 上架。
  • 目前有 400 個安裝啟用數。
  • 上一次更新是 2018-06-21,距離現在已有 2509 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 外掛最低要求 WordPress 4.7 以上版本才可以安裝。
  • 有 14 人給過評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

coffee2code |

外掛標籤

users | signup | username | registration | restrictions |

內容簡介

這個外掛允許你限制使用者在註冊網站時可以使用的使用者名稱。

如果在你的網站啟用了公開註冊(透過「設定」-> 「一般」-> 「會員資格」(「任何人都可以註冊」)),WordPress 允許訪客在你的部落格上註冊帳號。預設情況下,只要它不是已經存在的帳戶並且不包括無效(即非字母數字)字元,它所選擇的任何使用者名稱都是允許的。

限制某些使用者名稱可能的原因:

防止使用含污穢、冒犯或其他不合適的字詞的使用者名稱
防止使用者佔用未來可能想要使用的使用者名稱(但還不想立即創建帳號)(實質上將使用者名稱保留)
防止使用者使用官方的聽起來很正式的使用者名稱(例如:help、support、pr、info、sales)
防止使用者使用官方使用者名稱語法(例如:如果所有管理員都使用前綴字元來識別自己,你不想讓訪問者使用該前綴字元)
防止使用者在使用者名稱中使用空格(這是 WordPress 預設允許的)
要求使用者名稱以一個字元集開始、結尾或包含(例如:「support_」、「admin_」)
要求使用者名稱的最小字元數
限制使用者名稱的最大字元數

當嘗試使用限制的使用者名稱註冊時,訪客將收到錯誤通知,即:

錯誤:此使用者名稱無效。請輸入有效的使用者名稱。

注意:此外掛不會對管理員在 WordPress 內建立用戶帳戶時選擇的使用者名稱進行任何限制。這僅限制用戶在註冊網站時自己選擇的名稱。

特別注意:許多會員外掛會實現自己的使用者註冊處理,通常會繞過 WordPress 執行的檢查(和連接)。因此,如果沒有特殊的外掛特定修改,它可能不與這些外掛兼容。

與 Multisite 和 BuddyPress 也兼容。

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

Hooks

這個外掛公開了一個可連接的篩檢器。通常,使用此連接器進行自定義的客製化檢查,可以將其放入你的現行主題的 functions.php 檔案中,或由另一個外掛使用。

c2c_restrict_usernames-validate (篩檢器)

「c2c_restrict_usernames-validate」連接器允許你新增自己定制的使用者名稱檢查。你可以新增其他限制或覆蓋外掛的評估。

引數:

$valid(布林值):外掛信根據設置進行的關於使用者名稱有效性的評估,True 表示可以使用使用者名稱。
$username(字串):正在註冊的使用者名稱。
$settings(陣列):外掛設置。

範例:

/**
* 添加使用者名稱自定義檢查。
*
* 具體來說,防止使用以數字結尾的使用者名稱。
*
* @param bool $valid 如果使用者名稱有效,則為 True,否則為 False。
* @param string $username 使用者名稱。
* @param array $options 外掛選項。
*/
function my_restrict_usernames_check($valid, $username, $options) {

原文外掛簡介

This plugin allows you to restrict the usernames that new users may use when registering for your site.
If open registration is enabled for your site (via Settings -> General -> Membership (“Anyone can register”)), WordPress allows visitors to register for an account on your blog. By default, any username they choose is allowed so long as it isn’t an already existing account and it doesn’t include invalid (i.e. non-alphanumeric) characters.
Possible reasons for wanting to restrict certain usernames:

Prevent usernames that contain foul, offensive, or otherwise undesired words
Prevent squatting on usernames that you may want to use in the future (but don’t want to actually create the account for just yet) (essentially placing a hold on the username)
Prevent official-sounding usernames from being used (i.e. help, support, pr, info, sales)
Prevent official username syntax from being used (i.e. if all of your administrators use a prefix to identify themselves, you don’t want a visitor to use that prefix)
Prevent spaces from being used in a username (which WordPress allows by default)
Require that a username starts with, ends with, or contain one of a set of substrings (i.e. “support_”, “admin_”)
Require a minimum number of characters for usernames
Limit usernames to a maximum number of characters

When attempting to register with a restricted username, the visitor will be given an error notice that says:
ERROR: This username is invalid. Please enter a valid username.
NOTE: This plugin does not put any restrictions on usernames that the admin chooses for users when creating user accounts from within the WordPress admin. This only restricts the names that users choose themselves when registering for your site.
SPECIAL NOTE: Many membership plugins implement their own user registration handling that often bypasses checks (and hooks) performed by WordPress. As such, it is unlikely that the plugin is compatible with them without special plugin-specific amendments.
Compatible with Multisite and BuddyPress as well.
Links: Plugin Homepage | Plugin Directory Page | GitHub | Author Homepage
Hooks
The plugin exposes one filter for hooking. Typically, customizations utilizing this hook would be put into your active theme’s functions.php file, or used by another plugin.
c2c_restrict_usernames-validate (filter)
The ‘c2c_restrict_usernames-validate’ hook allows you to add your own customized checks for the username being registered. You can add additional restrictions or override the assessment performed by the plugin.
Arguments:

$valid (boolean): The assessment by the plugin about the validity of the username based on settings. True means username can be used.
$username (string): The username being registered.
$settings (array): The plugin’s settings.

Example:
/**
* Add custom checks on usernames.
*
* Specifically, prevent use of usernames ending in numbers.
*
* @param bool $valid True if the username is valid, false if not.
* @param string $username The username.
* @param array $options Plugin options.
*/
function my_restrict_usernames_check( $valid, $username, $options ) {
// Only do additional checking if the plugin has already performed its
// checks and deemed the username valid.
if ( $valid ) {
// Don't allow usernames to end in numbers.
if ( preg_match( '/[0-9]+$/', $username ) ) {
$valid = false;
}
}
return $valid;
}
add_filter( 'c2c_restrict_usernames-validate', 'my_restrict_usernames_check', 10, 3 );

各版本下載點

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

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


1.0 | 1.1 | 3.0 | 3.1 | 3.2 | 3.3 | 3.4 | 3.5 | 3.6 | 3.7 | 3.0.1 | 3.4.1 | 3.5.1 | trunk |

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

  • Mailchimp List Subscribe Form 》使用 MailChimp List Subscribe 外掛快速在 WordPress 2.8 及以上版本的網站上新增 MailChimp 訂閱表單小工具。, 安裝後,您可以使用 API 金鑰登入,選擇您的...。
  • Mailjet Email Marketing 》Mailjet 的官方 WordPress 外掛讓您可以:, - 輕鬆管理電子郵件:直接從 WordPress 的管理後台建立和管理所有行銷和交易電子郵件活動。, - 註冊表格和聯絡人...。
  • GetResponse for WordPress 》WordPress 用 GetResponse 外掛, WordPress 用 GetResponse 外掛可讓您將網站訪客加到聯絡清單,更新聯絡資訊,並將您的 GetResponse 登陸頁面新增為 WordPre...。
  • Allow Multiple Accounts 》允許建立、註冊及更新多個具有相同電子郵件地址的使用者帳戶。, 預設情況下,WordPress 只允許一個特定的電子郵件地址用於單一使用者帳戶。此外掛移除此限制...。
  • Participants Database 》此外掛完整提供建立和維護人員或任何你想要的資料庫所需的所有功能。資料庫是可以完全配置的,允許您為每個記錄定義要存儲的所有信息字段。記錄可以逐個在 Wo...。
  • Volunteer Sign Up Sheets 》請勿將支援論壇用於功能請求!!, 您可以在這裡提交新功能:, https://stephensherrardplugins.com/support/forum/feature-requests/pta-volunteer-sign-up-s...。
  • WP Telegram Login & Register 》讓使用者使用 Telegram 登入您的網站,讓他們更容易連線,並讓他們透過 Telegram 接收電子郵件通知。, 優質支援, 加入聊天室, 我們在 Telegram 上有一個公開...。
  • Woocommerce Login / Signup Lite 》本免費版WordPress外掛提供三個簡單的短代碼來創建您的電子商務網站註冊及登入系統,您可以將它們嵌入網站代碼中,創建註冊及登入小工具或頁面。此外掛還提供...。
  • Simple Membership MailChimp Integration 》這個外掛讓你可以為每一個訪問等級指定一個 MailChimp 清單名稱。當會員加入您的網站時,他們會被註冊到指定的 MailChimp 清單中。, 這個外掛需要使用Simple ...。
  • Sign-up Sheets 》此外掛允許您在 WordPress 網站上快速、輕鬆地設定報名表。可用於志工及時間點報名、人員和資源協調,以及更多其他用途。, Sign-Up Sheets 免費版本包括以下...。
  • One Tap Google Sign in 》這個外掛讓使用者在 WordPress 網站上新增 Google 的 One Tap 登入或註冊功能。, 相依性, , 需要 WordPress v5.1 或以上的版本, 需要 PHP v7.0 或以上的版本, 。
  • Simplr Registration Form Plus+ 》新功能, 此外掛的 Plus 版現在是免費的!它包括了 reCAPTCHA、Facebook Connect、自訂欄位UI、審核、自訂確認訊息。更多資訊請參考 http://mikevanwinkle.com...。
  • OTP-less one tap Sign in 》在您的 WordPress 網站上添加 WhatsApp 登入, , 👋 告別 OTP 密碼,體驗一種安全且無縫的登入體驗。, 📈 通過 WhatsApp 獲得更多用戶並推動更多轉換。, ⚡ 通...。
  • Action Network 》這是一個免費的 WordPress 外掛,由 Concerted Action 維護,專為 Action Network 在線組織工具而設計。, 功能:, , 從任何 Action Network 內嵌代碼創建 Wor...。
  • iContact Widget 》在部落格上簡單安裝 iContact 報名表單的外掛程式, 透過這個小工具,您可以將 iContact 的「自動註冊表單」加入您的側邊欄中。只需將在 iContact 中建立的表...。

文章
Filter
Apply Filters
Mastodon