-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Event Logging module: new hook to add event types #824
Comments
We understand your idea, but we have some issues with it. First of all a minor issue: no hook docs are provided with the patch. Especially since adding the data to the array is not really intuitive, hook docs need to be provided to explain what the hook does and how it works. We could write those docs ourselves of course, no problem with that. The other issue is more architecture related. The way in which the current system was implemented, makes enabling/disabling part of and the responsibility of the module that wants to log events. To me this makes sense, because an admin that wants to configure a new module, will be looking at the settings screen of that module. When storing the logging features in the event logging settings screen, a pointer is required in the module's settings to tell the admin to go do event logging to configure logging options. That feels counterintuitive to me. I do understand the idea though. When an admin is configuring his logging settings, then he might expect logging for modules to be part of the event logging module settings. In my intended architecture this is not the case, so he might overlook the log setting. These two sides of the story are that much equal IMO, that the only complete solution would be that both the module X and the event logging module would provide options for configuring the logging of the module X. The settings should appear in both settings screens. In the chat I talked about this with Thomas and here's a relevant part of that chat: {{{ To not create a hook now that induces some hacky way to link event logging and other modules, I change this ticket to a more general idea ticket for the event logging module to make integration better and easier. Features that I'd like to see:
This way, things are structured and settings can be applied on both settings screens. I will design and implement a system for this in the next update of the event logging module. By: mmakaay |
Replying to [comment:1 mmakaay]: Thanks for adding this. I like the proposed features, they perform the objective I was after in the first place (to encourage/support consolidating event settings). One other issue that you are resolving is the actual storage of log setting data, which IMO is better served by the event logging system, not the module itself. Another is that the event logging system itself is the best final word (again IMO) on whether an event should be logged. The module code (or even any other piece of code) is only worried about whether it is reporting a candidate loggable event, not whether or not an Admin has enabled/disabled logging for that event. The change will result in cleaner and more consistent module code in modules that choose to use logging, and may even encourage more event logging from modules. -phil. |
Replying to [comment:1 mmakaay]: Point noted regarding documentation of proposed hooks. I will remember that point in any future changes I propose. -phil. |
By: ts77 |
I would like to propose an enhancement to the core Event Logging module: add a hook that other modules can call to register their own event types into the EVENT_TYPES structure. The benefit to this is that modules can then choose to place their log types on the Event Logging settings pages, rather than on their own settings pages (well, they could if they want, but at least there would be a choice).
The code to do this is very simple, just put something like the following in ./mods/event_logging/event_logging.php:
{{{
// Allow other modules to register their event types to be controlled by the
// Event Logging settings page.
if (isset($GLOBALS["PHORUM"]["hooks"]["event_logging_types"]))
{
$eventtypes =& $GLOBALS["PHORUM"]["DATA"]["MOD_EVENT_LOGGING"]["EVENT_TYPES"];
$eventtypes = phorum_hook('event_logging_types', $eventtypes);
}
}}}
I have attached a modified event_logging.php.
Using the hook would be very easy within a module:
{{{
function phorum_mod_foo_event_logging_types($data)
{
$data["Module Foo events"] = NULL;
$data["mod_foo_event_1"] = "Cubs win the World Series";
$data["mod_foo_event_2"] = "Hell has frozen over";
return $data;
}
}}}
Reported by: [email protected]
Imported from TRAC: http://trac.phorum.org/ticket/930
The text was updated successfully, but these errors were encountered: