4WP Notifications

外掛說明

4WP Notifications delivers a unified in-app notification inbox for logged-in WordPress users: a header bell with unread badge, a full notifications page, optional WooCommerce order alerts, and tools for developers to fire notifications from custom code.

A plugin by 4wp.dev. 4WP is our project brand; the letters “WP” appear only as part of that brand name, not as a reference to WordPress. This plugin is not affiliated with, endorsed, or sponsored by WordPress.

Source code: github.com/4wpdev/4wp-notifications

Key features

  • Notifications Bell block — dropdown with unread count; add inside a Navigation block (header menu)
  • Notifications List block — full inbox page with mark read/unread and live polling
  • Shortcodes[forwp_notifications_bell] and [forwp_notifications] for classic themes
  • Direct notifications — admins broadcast to roles and/or individual users
  • WooCommerce — optional alerts for new orders and status changes
  • Developer hooksforwp_notification_event / 4wp_notification_event from PHP
  • REST API — list, unread count, mark read/unread, and send notifications (authenticated)

Privacy

Notifications are stored in your WordPress database and shown only to the logged-in recipient. Read endpoints require an authenticated user session. Send endpoints require administrator capability (default: manage_options). No data is sent to 4wp.dev.

Development

Human-readable PHP source is in the public GitHub repository above. No npm build step — block editor scripts ship as plain JS in assets/blocks/.

Run tests: composer install && composer test && composer run lint

Blocks

This plugin provides 2 blocks.

  • 4WP Notifications Bell (forwp/notifications-bell) — bell icon and recent notifications dropdown (Navigation child block).
  • 4WP Notifications List (forwp/notifications) — full notification list for a page.

適用於區塊編輯器

這個外掛提供 2 個可供 Gutenberg/區塊編輯器使用的區塊。

  • 4WP Notifications List Display the full in-app notifications list for the logged-in user.
  • 4WP Notifications Bell Bell icon with a dropdown of recent notifications. Add inside a Navigation block (header menu).

安裝方式

  1. Upload the plugin to /wp-content/plugins/4wp-notifications/ or install from the Plugins screen.
  2. Activate 4WP Notifications.
  3. Open 4WP Notifications Display and choose the page for “View all notifications”.
  4. Add the Notifications List block to that page (or save Display settings to auto-insert it).
  5. Add the Notifications Bell block inside your header Navigation block.
  6. Optional: enable WooCommerce notification types under Notification types.

常見問題集

Do visitors see notifications?

No. The bell and list render only for logged-in users.

Can I send a message to all customers?

Yes. Use Direct notifications, select the Customer role (or any role), and send.

Can developers send notifications from custom code?

Yes. Use the PHP hook forwp_notification_event or POST to /wp-json/forwp/v1/notifications (requires manage_options by default). See Documentation in the admin app.

Does WooCommerce require extra setup?

Install WooCommerce, then enable event types under Notification types.

Are shortcodes still supported?

Yes. Blocks are recommended for block themes; shortcodes remain for classic content and menus.

使用者評論

這個外掛目前沒有任何使用者評論。

參與者及開發者

以下人員參與了開源軟體〈4WP Notifications〉的開發相關工作。

參與者

將〈4WP Notifications〉外掛本地化為台灣繁體中文版

對開發相關資訊感興趣?

任何人均可瀏覽程式碼、查看 SVN 存放庫,或透過 RSS 訂閱開發記錄

變更記錄

1.2.0

  • REST API POST — send notifications to user_id or user_ids (default capability: manage_options).
  • Developer hooks: forwp_notification_event and legacy 4wp_notification_event.
  • Block editor assets for Bell and List blocks (inserter visibility and previews).
  • Auto-insert Notifications List block on the configured page.
  • Bell dropdown list refreshes on poll and when opening the menu.

1.1.0

  • Unified admin app (Display, Direct, Types, Documentation) aligned with 4WP Drive / Weather.
  • Notifications Bell block (forwp/notifications-bell) for headers and navigation.
  • Shared frontend renderers for blocks and shortcodes.
  • Role-based recipient targeting for direct admin notifications.
  • WooCommerce notification type toggles in settings.

1.0.4

  • Tabbed settings shell and notification type cards.

1.0.0

  • Initial release: shortcodes, list block, WooCommerce adapter, REST read API.