I have problems with this piece of code. Wordpress throws me this message:
Warning: Use of undefined constant auction_mask_displayname - assumed 'auction_mask_displayname' (this will throw an Error in a future version of PHP)
Code:
add_filter( 'woocommerce_simple_auctions_displayname', auction_mask_displayname );
function auction_mask_displayname( $displayname ) {
if ( current_user_can( 'editor' ) || current_user_can( 'administrator' ) ) {
return $displayname;
} else {
$length = strlen( $displayname );
$displayname = $displayname[0] . str_repeat( '*', $length - 2 ) . $displayname[ $length - 1 ];
}
return $displayname;
}