darylldelfin
Forum Replies Created
Viewing 4 replies - 1 through 4 (of 4 total)
-
To anyone who want to do this, this was how I was able to do it :
I wanted to retrieve log records where a context key named ‘user_id’ has a value of the selected user.
add_filter( 'simple_history/log_query_inner_where', function($where) { global $wpdb; if (isset($_GET['editUser'])) { $user_id = $_GET['editUser']; }else{ $user_id = get_current_user_id(); } $where .= sprintf(' AND id IN ( SELECT id # , c1.history_id, c2.history_id FROM %1$s AS h INNER JOIN %2$s AS c2 ON c2.history_id = h.id AND c2.key = "user_id" AND c2.value = "%3$s" ) ', $wpdb->prefix.'simple_history', $wpdb->prefix.'simple_history_contexts', $user_id); return $where; } );
I see, I also checked
SimpleHistoryLogQuery.php
and you’re right, I can’t search via custom context field straight out of the box. I’m looking forward for this feature request!Thanks,
DaryllHi P?r, Thanks. I’d like to search for not just the logger, I’d like to search for a value from a custom context field. Is this possible?
Hi Par, thanks.
I have an additional question,
is there any way that we can group the log entries, for example, a custom field in a log entry perhaps? Any way to do this? Thanks
Viewing 4 replies - 1 through 4 (of 4 total)