• For a long time I used login and email separately in the registration form. Now I removed the login field and added the username/email field instead of mail.

    And there was a problem.

    The user is created with login user@mail.com
    But the link to their profile looks like site.com/user/usermail-com

    This is incorrect because the profile works link site.com/user/user@mail.com

    Why when you go to the profile plugin removes @ and change . on – ?
    Although in the database and username looks like user@mail.com

    function generate_profile_slug removes @ and . that breaks all logic

    How can I remove conditions?

    $user_in_url = str_replace( '@', '', $user_in_url );
    if ( ( $pos = strrpos( $user_in_url, '.' ) ) !== false ) {
    	$search_length = strlen( '.' );
    	$user_in_url   = substr_replace( $user_in_url, '-', $pos, $search_length );
    }

    to link the user was the same as email!

    • This topic was modified 5 years, 6 months ago by Alex Human.
    • This topic was modified 5 years, 6 months ago by Alex Human.
Viewing 1 replies (of 1 total)
  • Hi there, I took a look out of curiosity and you do have a filter towards the end of UM->User->generate_profile_slug()

    $user_in_url = apply_filters( 'um_change_user_profile_slug', $user_in_url, $user_id );

    The line after that checks if $current_profile_slug != $user_in_url and updates if true.

    Haven’t tested it but might be what you’re looking for.

Viewing 1 replies (of 1 total)
  • The topic ‘Username as Email’ is closed to new replies.