• Good day,
    I have a problem with permalinks of users.My language is Slovak with special characters (example:??????yáíé).
    If I change Settings/Users/ “Profile Permalink Base to “First and Last Name “,
    Users permalink look like …/user/Kon?tantín.Ko?i?/.
    (First Name: Kon?tantín, Last Name: Ko?i?).
    How can I fix it for permalink …/user/konstantin.kocis/
    Thanks for your reply.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Scott Kondor

    (@slicedinamerica)

    Hi Micocico,

    I had a similar problem with accent characters becoming part of the Ultimate Member user permalink.

    To fix, I had to add a custom filter to /plugins/ultimate-member/core/um-permalinks.php on line 443 inside the “name_dash” case in the switch statement. Unfortunately this gets overwritten with each plugin update but it does solve the problem.

    $full_name_slug = apply_filters(“um_generate_permalink_filter”, $full_name_slug);

    With that filter in place, I then added code to my functions.php file to remove each character for the URL.

    function change_um_slug($value)
    {
    $replacements = array(
    ‘á’ => ‘a’,
    ‘á’ => ‘a’,
    ‘é’ => ‘e’,
    ‘é’ => ‘e’,
    ‘?’ => ‘c’,
    ‘?’ => ‘c’,
    ‘í’ => ‘i’,
    ‘í’ => ‘i’,
    ‘?’ => ‘n’,
    ‘?’ => ‘n’,
    ‘ó’ => ‘o’,
    ‘ó’ => ‘o’,
    ‘ú’ => ‘u’,
    ‘ü’ => ‘u’,
    ‘ü’ => ‘u’,
    ‘(‘ => ”,
    ‘)’ => ”,
    ‘”‘ => ”
    );
    foreach($replacements as $replacement => $replace)
    {
    $value = str_replace($replacement, $replace, $value);
    }
    return $value;
    }
    add_filter(‘um_generate_permalink_filter’, ‘change_um_slug’, 10, 2);

    Hope this works for you and hopefully the Ultimate Member team will include a filter in this file in a future release.

    Regards,
    ~Scott

    Thanks for sharing. For me this don’t have affects to permalink. So I changed this, add some more specialchars for german, french and italian and paste everything into /plugins/ultimate-member/core/um-permalinks.php#442.

    $replacements = array(
        'á' => 'a',
        'á' => 'a',
        'à' => 'a',
        'à' => 'a',
        '?' => 'a',
        'a' => 'a',
        '?' => 'ae',
        '?' => 'ae',
        '?' => 'ae',
        '?' => 'ae',
        'é' => 'e',
        'é' => 'e',
        'è' => 'e',
        'è' => 'e',
        'ê' => 'e',
        'ê' => 'e',
        '?' => 'e',
        '?' => 'e',
        '?' => 'c',
        '?' => 'c',
        'ì' => 'i',
        'ì' => 'i',
        'í' => 'i',
        'í' => 'i',
        '?' => 'i',
        '?' => 'i',
        '?' => 'i',
        '?' => 'i',
        '?' => 'n',
        '?' => 'n',
        'ò' => 'o',
        'ò' => 'o',
        'ó' => 'o',
        'ó' => 'o',
        '?' => 'o',
        '?' => 'o',
        '?' => 'oe',
        '?' => 'oe',
        '?' => 'oe',
        '?' => 'oe',
        '?' => 'ss',
        'ù' => 'u',
        'ù' => 'u',
        'ú' => 'u',
        'ú' => 'u',
        '?' => 'u',
        '?' => 'u',
        'ü' => 'ue',
        'ü' => 'ue',
        '?' => 'y',
        '?' => 'y',
        '(' => '',
        ')' => '',
        '”' => ''
    );
    foreach($replacements as $replacement => $replace)
    	$full_name_slug = str_replace( $replacement , $replace, $full_name_slug );
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘User permalink problem with special characters’ is closed to new replies.