Ability to search in DB logs.
This commit is contained in:
parent
63877adfb6
commit
d8a6cc6eb2
|
@ -334,6 +334,10 @@ class WC_Admin_Log_Table_List extends WP_List_Table {
|
||||||
$where_conditions[] = 'source = %s';
|
$where_conditions[] = 'source = %s';
|
||||||
$where_values[] = wc_clean( $_REQUEST['source'] );
|
$where_values[] = wc_clean( $_REQUEST['source'] );
|
||||||
}
|
}
|
||||||
|
if ( ! empty( $_REQUEST['s'] ) ) {
|
||||||
|
$where_conditions[] = 'message like %s';
|
||||||
|
$where_values[] = '%' . wc_clean( $_REQUEST['s'] ) . '%';
|
||||||
|
}
|
||||||
|
|
||||||
if ( ! empty( $where_conditions ) ) {
|
if ( ! empty( $where_conditions ) ) {
|
||||||
return $wpdb->prepare( 'WHERE 1 = 1 AND ' . implode( ' AND ', $where_conditions ), $where_values );
|
return $wpdb->prepare( 'WHERE 1 = 1 AND ' . implode( ' AND ', $where_conditions ), $where_values );
|
||||||
|
|
|
@ -6,8 +6,17 @@
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
$s = '';
|
||||||
|
if ( isset( $_REQUEST['s'] ) ) {
|
||||||
|
$s = wc_clean( $_REQUEST['s'] );
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
<form method="get" id="mainform" action="">
|
<form method="get" id="mainform" action="">
|
||||||
|
<p class="search-box">
|
||||||
|
<label class="screen-reader-text" for="post-search-input"><?php _e( 'Search logs', 'woocommerce' ); ?></label>
|
||||||
|
<input type="search" id="post-search-input" name="s" value="<?php echo esc_attr( $s ); ?>">
|
||||||
|
<input type="submit" id="search-submit" class="button" value="<?php _e( 'Search logs', 'woocommerce' ); ?>">
|
||||||
|
</p>
|
||||||
|
|
||||||
<?php $log_table_list->display(); ?>
|
<?php $log_table_list->display(); ?>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue