• Resolved liquidonthedrums

    (@liquidonthedrums)


    Hi,

    I have used the docs and sample plugin provided on your site in hope to set up a custom event sensor.

    I want to have the logic contained in my theme so am using the ‘wsal_custom_sensors_classes_dirs’ hook to change the path for the sensor. However, I can’t seem to get this hook to fire??

    The Sensor class lives at /wp-content/my-theme/src/ce-wp-activity-log/custom-sensors

    The filter in my functions.php file is as follows:

    add_filter( ‘wsal_custom_sensors_classes_dirs’, ‘add_custom_sensors_path’ );

    function add_custom_sensors_path($paths = []): array {
    $paths = ( is_array( $paths ) ) ? $paths : array();
    $paths[] = trailingslashit( trailingslashit( get_stylesheet_directory() ) . ‘src’ . DIRECTORY_SEPARATOR . ‘ce-wp-activity-log’ . DIRECTORY_SEPARATOR . ‘custom-sensors’ );
    return $paths;
    }

    I am also using the Gravity forms extension and can see that it uses the same hook. When I var_dump() out the $paths variable in the SensorManager.php (where the filter is run), the Gravity forms path is there, but mine isn’t.

    Just wondering if you might know what the issue is here? Any assistance would be much appreciated. Thanks

    *** Update ***
    After some additional investigation I have found that my hook is being included, but only on the front end of the site. I am wanting to capture some admin events… is this possible? Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support robertabela

    (@robert681)

    Hello @liquidonthedrums

    Thank you very much for using our plugin.

    May I ask why you would want to have the logic contained in your theme? The first thing I would recommend, is to follow the steps in the guide on how to create an activity log extension – in short, the extensions should be a standalone plugin.

    There are a number of reasons why we use such setup, so this would be my first recommendation.

    Please let me know if that does the trick.

    Looking forward to hearing from you.

    Thread Starter liquidonthedrums

    (@liquidonthedrums)

    Hi @robert681 ,

    The reason for including in the theme is that my theme is a packaged set of functionality. While I understand the benefits of modularizing functionality, it is not the best solution for this current project.

    Regardless, I have attempted to follow the guide to create a plugin but am still having issues.

    There are links to multiple sample plugins on the linked page:
    https://github.com/WPWhiteSecurity/wsal-extension-example
    https://wpactivitylog.com/downloads/wsal-plugin/wp-security-audit-log-custom-events-sample-plugin.zip

    There are also references to using a mu-plugin, and then it also says to create sensors in the ‘/wp-content/uploads/wp-security-audit-log/custom-sensors/’ directory.

    I’m a bit confused as to what the structure of the plugin/ code needs to be and where it needs to be located. Ultimately, I am using the Gravity Forms PHP API functions and want to be able to fire a custom event after my code is executed.

    Any assistance would be greatly appeciated. Thanks.

    Plugin Support robertabela

    (@robert681)

    Hello @liquidonthedrums

    I am sorry for the late response. We’ve been quite busy with the release of another plugin of ours, and this slipped through the crack – apologies.

    In regards to your issue; we have tested the extension we refer to and can confirm that it captures changes from both the dashboard and the backend. So offhand it is difficult to say why you are encountering this issue without looking at your code. Would you be able to share that?

    If there is too much sensitive and technical data in the code, you can send us your extension via email, at [email protected].

    Looking forward to hearing from you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom Sensor Help’ is closed to new replies.