Background
The plugin currently triggers two events when a message is posted
(chatbox_menu.php, lines 123–125):
$e_event->trigger('cboxpost', $edata_cb); // deprecated
e107::getEvent()->trigger('user_chatbox_post_created', $edata_cb);
This is a half-finished migration inherited from the upstream chatbox_menu
plugin. The new event name user_chatbox_post_created follows e107's
event naming convention (user_<plugin>_<thing>_<verb_past> for
user-initiated actions, admin_<plugin>_<thing>_<verb_past> for
admin-initiated actions). The trigger site was updated, but e_notify.php
still registers the old cboxpost name as the canonical event, so the new
event was never reachable through the admin Notify UI.
Decision
Single canonical event, drop the deprecated alias.
- Keep:
user_chatbox_post_created
- Remove:
cboxpost
Why hard break
The README is clear that this fork is a clean break, not a drop-in
replacement ("It is intended for new installs only and shares no markup,
class names, or upgrade path with the original chatbox_menu plugin").
Maintaining cboxpost as a deprecated alias adds noise for no real
benefit: listeners on the original chatbox_menu plugin are bound to that
plugin's namespace, and existing notify configurations from the old plugin
do not carry over.
Changes
chatbox_menu.php
Replace the two trigger() calls with the canonical one:
e107::getEvent()->trigger('user_chatbox_post_created', $edata_cb);
Also drop the global $e_event; declaration earlier in the function — the
modern e107::getEvent() accessor is already used on the next line, so the
older global variable is redundant.
e_notify.php
- Remove the commented-out legacy
notify_cboxpost() function block
(~10 lines of dead code at the top of the file).
- Update the
config() registration:
$config[] = array(
'name' => NT_LAN_CB_2,
'function' => "user_chatbox_post_created",
'category' => ''
);
- Rename the handler method
cboxpost($data) to
user_chatbox_post_created($data).
- Update the
$this->send('cboxpost', ...) call inside that method to
$this->send('user_chatbox_post_created', ...).
Database side effect
Existing installs may have a stale cboxpost entry in notify_prefs from
the original chatbox_menu plugin. After this change, that entry becomes
dormant (nothing triggers cboxpost anymore) and is no longer
configurable through the admin UI. The new user_chatbox_post_created
event will register cleanly on next visit to the admin Notify page.
Users can either ignore the dormant cboxpost entry or remove it manually
from notify_prefs. This migration noise affects only sites that
previously had chatbox_menu installed; fresh installs are unaffected.
Out of scope (follow-up issues)
These belong in their own tickets but are worth noting now so the picture
of the plugin's event surface is documented:
- Admin moderation events:
chat.php provides moderation controls
(delete / block / unblock messages) that currently do not trigger any
events. Following the same convention, these would become
admin_chatbox_post_deleted, admin_chatbox_post_blocked, and
admin_chatbox_post_unblocked. Useful for audit logging, statistics, or
notifying users that their post was moderated.
- Notify message body cleanup: the
NT_LAN_CB_* constants and the HTML
inside the notify message body can be revisited as part of the broader
markup cleanup pass.
Related
This issue surfaced while testing #N (template system split). A stale
notify_prefs entry referencing the original chatbox_menu_notify class
caused fatal errors on message post. The class lookup error is a separate
e107 core robustness issue (filed upstream: [link to e107inc/e107 issue
once created]) — even after this rename, e107 should not fatal when a
notify handler points at a missing class.
Verification
After the rename:
- Posting a message must not fatal.
- The
user_chatbox_post_created event appears in the Notify admin
configurable list.
- Test event from the Notify admin page fires successfully.
- A handler registered via
e_event.php → register('user_chatbox_post_created', ...)
in another plugin receives the event.
Background
The plugin currently triggers two events when a message is posted
(
chatbox_menu.php, lines 123–125):This is a half-finished migration inherited from the upstream
chatbox_menuplugin. The new event name
user_chatbox_post_createdfollows e107'sevent naming convention (
user_<plugin>_<thing>_<verb_past>foruser-initiated actions,
admin_<plugin>_<thing>_<verb_past>foradmin-initiated actions). The trigger site was updated, but
e_notify.phpstill registers the old
cboxpostname as the canonical event, so the newevent was never reachable through the admin Notify UI.
Decision
Single canonical event, drop the deprecated alias.
user_chatbox_post_createdcboxpostWhy hard break
The README is clear that this fork is a clean break, not a drop-in
replacement ("It is intended for new installs only and shares no markup,
class names, or upgrade path with the original chatbox_menu plugin").
Maintaining
cboxpostas a deprecated alias adds noise for no realbenefit: listeners on the original
chatbox_menuplugin are bound to thatplugin's namespace, and existing notify configurations from the old plugin
do not carry over.
Changes
chatbox_menu.phpReplace the two
trigger()calls with the canonical one:Also drop the
global $e_event;declaration earlier in the function — themodern
e107::getEvent()accessor is already used on the next line, so theolder global variable is redundant.
e_notify.phpnotify_cboxpost()function block(~10 lines of dead code at the top of the file).
config()registration:cboxpost($data)touser_chatbox_post_created($data).$this->send('cboxpost', ...)call inside that method to$this->send('user_chatbox_post_created', ...).Database side effect
Existing installs may have a stale
cboxpostentry innotify_prefsfromthe original
chatbox_menuplugin. After this change, that entry becomesdormant (nothing triggers
cboxpostanymore) and is no longerconfigurable through the admin UI. The new
user_chatbox_post_createdevent will register cleanly on next visit to the admin Notify page.
Users can either ignore the dormant
cboxpostentry or remove it manuallyfrom
notify_prefs. This migration noise affects only sites thatpreviously had
chatbox_menuinstalled; fresh installs are unaffected.Out of scope (follow-up issues)
These belong in their own tickets but are worth noting now so the picture
of the plugin's event surface is documented:
chat.phpprovides moderation controls(delete / block / unblock messages) that currently do not trigger any
events. Following the same convention, these would become
admin_chatbox_post_deleted,admin_chatbox_post_blocked, andadmin_chatbox_post_unblocked. Useful for audit logging, statistics, ornotifying users that their post was moderated.
NT_LAN_CB_*constants and the HTMLinside the notify message body can be revisited as part of the broader
markup cleanup pass.
Related
This issue surfaced while testing #N (template system split). A stale
notify_prefsentry referencing the originalchatbox_menu_notifyclasscaused fatal errors on message post. The class lookup error is a separate
e107 core robustness issue (filed upstream: [link to e107inc/e107 issue
once created]) — even after this rename, e107 should not fatal when a
notify handler points at a missing class.
Verification
After the rename:
user_chatbox_post_createdevent appears in the Notify adminconfigurable list.
e_event.php → register('user_chatbox_post_created', ...)in another plugin receives the event.