[WordPress] 外掛分享: Notification system

首頁外掛目錄 › Notification system
WordPress 外掛 Notification system 的封面圖片
⚠ 此外掛已下架 — 不再更新維護,建議勿安裝。
10+
安裝啟用
★★★☆☆
3.7/5 分(3 則評價)
739 天前
最後更新
問題解決
WordPress 5.0+ PHP 7.0+ v2.0.1 上架:2019-03-01

內容簡介

Notification System 外掛程式可在 WordPress 網站上為使用者建立並維護通知系統。

外掛程式在網站控制台中有選項頁面,提供相關按鈕和控制項。請參閱截圖。

後端

通知是通知型別的自訂文章。管理者具備標準的自訂文章介面,並可在管理介面中存取。

管理者能夠建立、編輯和刪除通知。一種分類法已經提供:頻道。管理者可以新增、編輯與刪除分類法詞彙。為了將通知限制為某些使用者,請加入使用者登入名稱,逗號分隔。

前端

外掛程式會在「飛翔中」建立頁面「/notifications」,該頁面不會在資料庫中存在。這個頁面的資訊僅對已登錄的使用者可見(受 REST API 控制權限的限制)。

如果網址包含 hash #notifications,外掛程式會建立一個彈出視窗: 例如: http://my.site.org/some-url#notifications。這是一種簡單的方式,可以從任何地方顯示帶有通知的彈出視窗。只需建立這樣的連結:<a href="http://my.site.org#notifications">Notifications</a>,單擊此連結將打開帶有通知的彈出視窗。

已登錄使用者可以列出通知,並按頻道篩選它們。

顯示更多按鈕提供通知列表的分頁。

對於具有「edit_posts」能力的使用者,會顯示額外的按鈕:創建、更新和刪除。彈出視窗提供相關輸入。所有通知都可以從前端進行編輯。

網站管理員

在選單中新增自訂連結,使用 #notifications網址。使用任何導覽標籤或空格作為空標籤。保存選單。在站點前端,您將看到具有圖示和未讀數的新選單項目。單擊此選單項目將打開帶有通知的彈出視窗。

開發人員

建立具有類別「unread-notifications-count」的元素。這類元素的最佳位置是標題或導覽菜單中的某處。這個元素(它們)可以在自訂 JS 事件「update_unread_counts」期間由外掛程式更新。例如:

const count = 5;
document.dispatchEvent(
new CustomEvent(
'update_unread_counts',
{ 'detail': count }
)
);

從 PHP 代碼中,可以使用「update_unread_counts」動作更新目前使用者的元素計數。例如:

do_action( 'update_unread_counts' );

可翻譯

外掛程式已準備好翻譯。所有字串都通過 gettext 函數輸出。在 /language 目錄中有一個 .pot 檔案,內含收集到的字串。

程式碼

PHP 程式碼符合 PHP 5.6 標準。
JS 程式碼符合 ES6 標準。

所有程式碼都由 PHP Code Sniffer 檢查,符合 WordPress 程式碼標準。

外掛標籤

開發者團隊

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

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

原文外掛簡介

Notification System plugin creates and maintains a notification system for users on WordPress site.
The plugin has the Options page in the site console, with relevant buttons and controls. Please see screenshots.
Backend
Notifications are custom posts of type notification. There is a standard custom post interface, with a menu in admin.
Administrator can create, edit, and delete notifications. One taxonomy is available: Channel. Administrator is able to add, edit, and delete taxonomy terms. To restrict notification to some users, add user logins as a comma-separated list.
Frontend
Plugin creates page /notifications “on the fly” — it does not exist in the database. Information on this page is visible only to the logged-in users (restricted by permissions in REST API Controller).
Plugin creates a popup window if url contains hash #notifications, like that: http://my.site.org/some-url#notifications. This is an easy way to show a popup window with notifications from anywhere. Just create a link like Notifications and a click on this link will open a popup window with notifications.
Logged-in users can list notifications and filter them by a channel.
Show more button provides pagination of the notification list.
For those users who have the capability ‘edit_posts’, additional buttons are shown: Create, Update, and Delete. Popup windows provide relevant inputs. All notifications can be edited right from the frontend.
Site administrators
Add a custom link to the menu, with #notifications url. Use any navigation label or space(s) for empty label. Save menu. On the site frontend, you will see a new menu item with icon and unread count. By clicking on this menu item, a popup window with notifications will be opened.
Developers
Create an element(s) with the class unread-notifications-count. The best place for such element(s) is somewhere in the header or menu. It(they) can be updated by plugin during custom JS event update_unread_counts. Example:
const count = 5;
document.dispatchEvent(
new CustomEvent(
'update_unread_counts',
{ 'detail': count }
)
);

From php code, count element(s) for current user can be updated using ‘update_unread_counts’ action. Example:
do_action( 'update_unread_counts' );

Translation-ready
The plugin is prepared for translation. All strings are output via gettext functions. There is a .pot file in /language directory with strings collected.
Code
The PHP code conforms to PHP 7.0 level.
The JS code conforms to ES6 level.
All code is checked by php Code Sniffer, and conforms to WordPress Coding Standards.

文章
Filter
Apply Filters
Mastodon