stream
stream copied to clipboard
Provide a filter when a filter for the data being inserted in the stream log
Delete the section that is not applicable:
Feature Request
A filter to modify the $recordarr variable before being inserted into the database will be very helpful.
https://github.com/xwp/stream/blob/33dcfa86932bffdc11cbf3ade3da73a38cd4818e/classes/class-log.php#L146
A use case we have is - We are processing a posts created by a user after the user is deleted. If the user is deleted from the network admin screen, Stream automatically sets blog_id to 0, Which is correct for most of the cases, but for this custom case, we would like the logs to be attached to the relevant sub-site.
With the filter mentioned above, We will be able to modify the blog_id based on the Connector that is being used for that particular log entry.
I can provide a pull request if this is accepted as a solution.
Hello again @Nikschavan! 👋🏻
You can modify the record array and I believe the filter you need here is wp_stream_record_array: https://github.com/xwp/stream/blob/33dcfa86932bffdc11cbf3ade3da73a38cd4818e/classes/class-db.php#L47
Let me know if that is not for what you are searching! 🙂