Datastore Conversion
Jamroom Developers
@michael
Perfect! This is clearly the way to go. Thanks much Michael.
ntComment_unregister_event_listener('jrCore', 'db_search_items', 'jrComment_db_search_items_listener');
function ntComment_unregister_event_listener($module, $event, $function)
{
$ename = "{$module}_{$event}";
if (($key = array_search($function, $GLOBALS['__JR_FLAGS']['jrcore_event_listeners'][$ename])) !== false)
{
unset($GLOBALS['__JR_FLAGS']['jrcore_event_listeners'][$ename][$key]);
}
return true;
}
function jrCore_register_event_listener($module, $event, $function)
{
// We can register 1 of 3 events:
// a specific event from a specific module - i.e. 'jrUser','get_info_by_id'
// all events from a specific module - i.e. 'jrUser','all_events'
// all events for the whole system - i.e. 'jrCore','all_events'
if (!isset($GLOBALS['__JR_FLAGS']['jrcore_event_listeners'])) {
$GLOBALS['__JR_FLAGS']['jrcore_event_listeners'] = array();
}
$ename = "{$module}_{$event}";
if (!isset($GLOBALS['__JR_FLAGS']['jrcore_event_listeners'][$ename])) {
$GLOBALS['__JR_FLAGS']['jrcore_event_listeners'][$ename] = array();
}
$GLOBALS['__JR_FLAGS']['jrcore_event_listeners'][$ename][] = $function;
return true;
}
$GLOBALS['__JR_FLAGS']['jrcore_event_listeners']
jrComment_db_search_items_listener
jrComment_thread_comment
jrComment_thread_comments