• Resolved czokalapik

    (@czokalapik)


    Hello, I’m trying to hook into log insert so I can set discord messages via webhook.

    I have my own custom events I want to catch, as well as default ones.

    So far I used add_action( 'simple_history/log/inserted') hook to trigger sending messages, but so far I encountered two problems:

    1: Events that are not triggered by any user (system and custom cron events) seem to not trigger that action
    2: How do I get already parsed message that is inserted into plugin?

    more on #2: when post is updated, I’m catching array of post title, old and new content etc, but how do I get actual parsed message like “Updated post ‘Title of the post'” message?

Viewing 1 replies (of 1 total)
  • Plugin Author eskapism

    (@eskapism)

    1) That actions should be trigged by all logged events. Could it be that your code only runs when in admin area on something like that?

    2) The complete message is not logged. Instead a “template” message is logged, for example something like “Updated {post_type} ‘{post_title}'” and then when the message is getting displayed in the GUI it glues together the message with the “context data” that has been saved for that event. You can check the method interpolate() in SimpleLogger.php to see an example on how to do this.

Viewing 1 replies (of 1 total)
  • The topic ‘Hook into log insertion to send custom events’ is closed to new replies.