Automattic\WooCommerce\Internal\StockNotifications\Admin
ListTable::display_customer_dropdown
Display customer filter.
Method of the class: ListTable{}
No Hooks.
Returns
null. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->display_customer_dropdown();
ListTable::display_customer_dropdown() ListTable::display customer dropdown code WC 10.3.6
<?php
protected function display_customer_dropdown() {
$user_string = '';
$user_id = '';
if ( ! empty( $_GET['customer_stock_notifications_customer_filter'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
$user_id = wc_clean( wp_unslash( $_GET['customer_stock_notifications_customer_filter'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
$user = get_user_by( 'id', absint( $user_id ) );
if ( $user ) {
$user_string = sprintf(
/* translators: 1: user display name 2: user ID 3: user email */
esc_html__( '%1$s (#%2$s – %3$s)', 'woocommerce' ),
$user->display_name,
absint( $user->ID ),
$user->user_email
);
}
}
?>
<select class="wc-customer-search" name="customer_stock_notifications_customer_filter" data-placeholder="<?php esc_attr_e( 'Select customer…', 'woocommerce' ); ?>" data-allow_clear="true" id="customer_stock_notifications_customer_filter">
<?php if ( $user_string && $user_id ) { ?>
<option value="<?php echo esc_attr( $user_id ); ?>" selected="selected"><?php echo wp_kses_post( htmlspecialchars( $user_string, ENT_COMPAT ) ); ?></option>
<?php } ?>
</select>
<?php
}