• Hi, I need to remove the ability to insert emojis into the text area.
    The problem is that when I print a gift card that has a message containing an emoji, a square is printed because the emoji does not display correctly.

    Thank you

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Juan Coronel

    (@juaancmendez)

    Hi there,
    thanks for contacting us and I hope you’re doing well!

    We have a code to avoid taking into account emojis added to the textarea. You can use it by adding it in the functions.php file of your active theme:

    if ( ! function_exists( 'ywgc_message_cart_item_data_remove_emojis' ) ) {
    function ywgc_message_cart_item_data_remove_emojis( $message ) {
    // Match Enclosed Alphanumeric Supplement
    $regex_alphanumeric = '/[\x{1F100}-\x{1F1FF}]/u';
    $clear_string = preg_replace($regex_alphanumeric, '', $message);

    // Match Miscellaneous Symbols and Pictographs
    $regex_symbols = '/[\x{1F300}-\x{1F5FF}]/u';
    $clear_string = preg_replace($regex_symbols, '', $clear_string);

    // Match Emoticons
    $regex_emoticons = '/[\x{1F600}-\x{1F64F}]/u';
    $clear_string = preg_replace($regex_emoticons, '', $clear_string);

    // Match Transport And Map Symbols
    $regex_transport = '/[\x{1F680}-\x{1F6FF}]/u';
    $clear_string = preg_replace($regex_transport, '', $clear_string);

    // Match Supplemental Symbols and Pictographs
    $regex_supplemental = '/[\x{1F900}-\x{1F9FF}]/u';
    $clear_string = preg_replace($regex_supplemental, '', $clear_string);

    // Match Miscellaneous Symbols
    $regex_misc = '/[\x{2600}-\x{26FF}]/u';
    $clear_string = preg_replace($regex_misc, '', $clear_string);

    // Match Dingbats
    $regex_dingbats = '/[\x{2700}-\x{27BF}]/u';
    $message = preg_replace($regex_dingbats, '', $clear_string);

    return $message;
    }
    add_filter( 'ywgc_message_cart_item_data', 'ywgc_message_cart_item_data_remove_emojis', 99 );
    }

    Check it out and tell us if it works well for you, please.

    Best regards.

    Thread Starter chiara20wd

    (@chiara20wd)

    I added yout code in my function.php but I can still add emoji to textarea

    https://ibb.co/bNKGbD4

    • This reply was modified 2 months, 2 weeks ago by chiara20wd.
    Plugin Support Juan Coronel

    (@juaancmendez)

    Hello there,

    I can’t see the image you shared. However, it is not possible to prevent someone from inserting an emoji into the textarea. What the code provided does is prevent emojis from being taken into account in the gift card sent.

    Let us know any news.

    Best regards.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.