[WordPress] 外掛分享: Mm Ajax Login

WordPress 外掛 Mm Ajax Login 的封面圖片。

前言介紹

  • 這款 WordPress 外掛「Mm Ajax Login」是 2015-08-22 上架。
  • 目前有 10 個安裝啟用數。
  • 上一次更新是 2015-12-07,距離現在已有 3438 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 外掛最低要求 WordPress 3.8 以上版本才可以安裝。
  • 尚未有人給過這款外掛評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

braad | mightyminnow |

外掛標籤

ajax | form | login | lightbox |

內容簡介

這個外掛可以讓你建立特殊的連結,在檢查使用者是否已登入之後,如果已登入就直接轉頁到該連結所指的網頁;如果未登入,則會在簡單的燈箱中顯示 AJAX 驅動的登入表單。當使用者填寫有效的憑證,他們就會登入並被重新導向到該連結所指的頁面。

情境

假設你的網站上有一個只有已登入使用者才能存取的頁面。這可能是一個私人頁面,或者最好是一個能向未登入使用者顯示標準登入表單的頁面。你可以在指向該頁面的所有連結中加入「ajax-login-trigger」類別。當使用者點擊其中一個連結時,將向伺服器發送 AJAX 請求,檢查使用者是否已登入。如果使用者已登入,將直接重新導向到頁面,使用者甚至不會察覺到登入檢查已完成;如果使用者未登入,將顯示簡單的燈箱中的登入表單。當使用者填寫表單後,將發送第二個 AJAX 請求來嘗試登入,如果成功,使用者將被重新導向回原本的頁面。

自訂:

此外掛包含許多鉤子和過濾器,允許進行各種自訂和獨特用途。以下是一個快速列表:

動作:

mm_ajax_login_before_form_outside
mm_ajax_login_before_form_inside
mm_ajax_login_extra_buttons
mm_ajax_login_after_form_inside
mm_ajax_login_after_form_outside

過濾器:

mm_ajax_login_trigger_selector
mm_ajax_login_form_title
mm_ajax_login_status_message
mm_ajax_login_username_label
mm_ajax_login_password_label
mm_ajax_login_rememberme_text
mm_ajax_login_lost_password_text
mm_ajax_login_button_text
mm_ajax_login_custom_login_action
mm_ajax_login_email_login_fail_message
mm_ajax_login_success_message
mm_ajax_login_fail_message
mm_ajax_login_allow_email_login

使用這些鉤子可以完成許多事情。鉤子「mm_ajax_login_before_form_inside」和「mm_ajax_login_after_form_inside」允許在表單中添加任何自訂輸入元素。當提交登入表單時,包含在表單中的輸入元素的所有值都會傳遞給處理 AJAX 請求的 PHP 函數,然後該資料會傳遞給「mm_ajax_login_custom_login_action」過濾器。你可以使用此過濾器攔截傳入的資料,並進行任何自訂操作,例如在同一行動中註冊新使用者和登入他們。

過濾器示例

使用自訂選取器作為觸發連結:

add_filter( 'mm_ajax_login_trigger_selector', 'prefix_custom_login_trigger' );
function prefix_custom_login_trigger( $selector ) {

// 自訂選取器在這裡
$selector = '.my-custom-selector';

return $selector;
}

使用自訂狀態訊息:

add_filter( 'mm_ajax_login_status_message', 'prefix_custom_status_message' );
function prefix_custom_status_message( $status_message ) {

// 自訂狀態訊息在這裡
$status_message = 'Magic happening...';

return $status_message;
}

此外掛在Github上,歡迎提交拉取請求。

原文外掛簡介

This plugin allows you to create special links that check whether a user is logged in and then follow the link if they are or show an ajax-powered login form in a simple lightbox if they are not. Once the user fills out the login form with valid credentials they will be logged in and redirected to the page the link points to.
Scenario
Let’s say you’ve got a page on your site that only logged in users are able to access. It could be a private page or ideally it is a page that is set up to show a standard login form to users who are not logged in. With this plugin you could add the class ‘ajax-login-trigger’ to all the links that point to that page, then when a user clicks one of these links an ajax request is sent to the server to check whether the user is already logged in, and if they are the user is redirected to the page without ever noticing that the login check was done, or if they aren’t logged in they’ll see a login form appear in a simple lightbox. When the user fills out the form, a second ajax request is sent to the server to attempt to log them in, and if successful the user is redirected to the page.
Customize It!
This plugin includes lots of hooks and filters that allow for all sorts of customizations and unique use cases. Here’s a quick list:
Actions:
mm_ajax_login_before_form_outside
mm_ajax_login_before_form_inside
mm_ajax_login_extra_buttons
mm_ajax_login_after_form_inside
mm_ajax_login_after_form_outside

Filters:
mm_ajax_login_trigger_selector
mm_ajax_login_form_title
mm_ajax_login_status_message
mm_ajax_login_username_label
mm_ajax_login_password_label
mm_ajax_login_rememberme_text
mm_ajax_login_lost_password_text
mm_ajax_login_button_text
mm_ajax_login_custom_login_action
mm_ajax_login_email_login_fail_message
mm_ajax_login_success_message
mm_ajax_login_fail_message
mm_ajax_login_allow_email_login

Many things are possible with these hooks. The hooks mm_ajax_login_before_form_inside and mm_ajax_login_after_form_inside allow you to add any custom input elements to the form. When the login form is submitted all of the values from the input elements included in the form will get passed to the PHP function that processes the ajax request, which will then pass the data to the mm_ajax_login_custom_login_action filter. You can intercept the incoming data using this filter and proceed with any custom action you want, like registering new users and logging them in during the same action.
Filter Examples
Use a custom selector for the trigger link:
add_filter( 'mm_ajax_login_trigger_selector', 'prefix_custom_login_trigger' );
function prefix_custom_login_trigger( $selector ) {

// Custom selector goes here.
$selector = '.my-custom-selector';

return $selector;
}

Use a custom status message:
add_filter( 'mm_ajax_login_status_message', 'prefix_custom_status_message' );
function prefix_custom_status_message( $status_message ) {

// Custom status message goes here.
$status_message = 'Magic happening...';

return $status_message;
}

This plugin is on Github and pull requests are always welcome.

各版本下載點

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

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


1.0.0 | trunk |

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

  • WPS Hide Login 》中文, WPS Hide Login 是一個非常輕量的外掛,讓您輕鬆且安全地更改登入表單頁面的網址。它不會真正地重命名或更改核心檔案,也不會添加重寫規則。它只是攔截...。
  • Security Optimizer – The All-In-One Protection Plugin 》透過精心挑選且易於配置的功能,SiteGround Security 外掛提供了您所需的一切來保護您的網站並預防多種威脅,例如暴力破解攻擊、登錄錯誤、資料外洩等等。, ...。
  • Loginizer 》Loginizer 是一個 WordPress 外掛,可幫助您對抗暴力攻擊,當 IP 地址達到最大重試次數時,該外掛會阻止其登錄。您可以使用 Loginizer 將 IP 地址列入黑名單...。
  • Limit Login Attempts 》此外掛可限制正常登入及使用驗證 cookies 登入的次數。, WordPress 預設允許使用者無限次數嘗試登入,無論是透過登入頁面或是傳送特殊 cookies 皆可。這讓密...。
  • LoginPress | wp-login Custom Login Page Customizer 》LoginPress 外掛提供了很多自訂欄位,可以更改 WordPress 登入頁面的版面配置。您可以完全修改登入頁面的外觀和感覺,即使是登入錯誤訊息、忘記密碼錯誤訊息...。
  • WP Ghost (Hide My WP Ghost) – Security & Firewall 》Hide My WP Ghost 是一個 WordPress 安全外掛,透過強大且易於使用的功能,提供最佳的安全解決方案。它可以在不改變任何目錄或檔案的情況下,將網站的安全性...。
  • WPS Limit Login 》繁體中文, 限制通過登錄頁面和使用權限Cookie可能的登錄嘗試次數。, WordPress 默認情況下允許通過登錄頁面或發送特殊 Cookie 的方式進行無限制的登錄嘗試。...。
  • Login Lockdown & Protection 》Login LockDown 記錄每次失敗的登入嘗試的 IP 位址和時間戳記。如果在短時間內來自相同 IP 範圍的嘗試次數超過一定數量,那麼該 IP 位址的所有登入請求都會被...。
  • Custom Login Page Customizer 》Custom Login Page Customizer 外掛可讓您輕鬆地從 WordPress Customizer 自訂您的登入頁面!在儲存之前,您可以預覽自訂的登入頁面變更!太棒了,對吧?, , ...。
  • All In One Login — WordPress Login Security Plugin to Protect and Customize WP Admin 》Change wp-admin login 是一個輕量級的外掛程式,可讓您輕鬆且安全地更改 wp-admin,讓它變成您想要的東西。它不會重新命名或更改核心檔案,只是攔截頁面請求...。
  • WP fail2ban – Advanced Security 》Fail2ban是您可以實施來保護 WordPress 網站的最簡單和最有效的安全措施之一。, WP fail2ban 提供 WordPress 與 fail2ban 之間的連接:, Oct 17 20:59:54 foo...。
  • Theme My Login 》曾經希望您的 WordPress 登入頁面與網站的其餘部分相匹配嗎?現在您的願望成真了!「Theme My Login」讓您可以繞過預設的 WordPress 標誌登入頁面,該頁面與...。
  • Login No Captcha reCAPTCHA 》此外掛新增了 Google 無人類驗證功能的勾選框,可應用於您的 WordPress 和 Woocommerce 登錄、忘記密碼及使用者註冊頁面,讓人類使用者輕鬆透過勾選框登入,...。
  • WP-Members Membership Plugin 》8211; allows you to restrict file downloads to registered users only, with customizable download links., MailChimp Integration – integrates W...。
  • WP Hide & Security Enhancer 》WP-Hide 推出了最簡單的方法,完全隱藏 WordPress 核心文件、登錄頁面、佈景主題和外掛程式的路徑,使其不會顯示在前端,這是 Site Security 的一個巨大改進...。

文章
Filter
Apply Filters
Mastodon