Custom Transliteration

From WHMCS Documentation

Transliteration is the practice of converting a text from one writing system into another in a systematic way.

In WHMCS this is supported & can be used to automatically replace characters in a clients profile data that would otherwise cause third party systems such as hosting control panels and domain registrars to reject the automated API requests containing those characters.

A default function included in WHMCS will automatically take care of and replace the most common special characters that cause problems for users but if you need to tailor it to your specific needs, then you can do so by defining a hook_transliterate function within a file in the /includes/hooks/ directory as follows to override the default function, and specify your own custom character replacement process within it.

<?php

function hook_transliterate($string) {
    $string = str_replace("ž","z",$string);
    $string = str_replace("é","e",$string);
    return $string;
}

?>

The code above can simply be copied and pasted into a new file and saved into the /includes/hooks/ directory with any name to take effect. You can then customise the character replacements done by that function as desired and would just need to return the converted string at the end of the call. You do not need to use the add_hook function with this feature. The function must be specifically defined as hook_transliterate for it to work.