Skip to:
Content
Pages
Categories
Search
Top
Bottom

Include @ in username


  • axelmire
    Participant

    @axelmire

    Hi I am trying to include the @ character in username urls as medium.com does. ie medium.com/@username.I have managed to get the profile in root and the @ to display without converting to %40 but it produces 404 error on the profile page.
    Anybody have any ideas?

    wp 4.8
    bp 2.9

Viewing 2 replies - 1 through 2 (of 2 total)

  • axelmire
    Participant

    @axelmire

    I should also add that wordpress is configured for multisite.


    livingflame
    Participant

    @livingflame

    Functions.php
    Only works with Newest Registered.

    // Force Strong Username
    function strong_username() {
     global $bp;
    
     if ( !empty( $_POST['signup_username'] ) )
       if ( !valid_username( $_POST['signup_username'] ) ){
        $bp->signup->errors['signup_username'] = __( 'Your username is too weak or short. Please, use uppercase, lowercase and numbers.', 'bp-strong-username-password', 'buddypress' );
       }
     }
     add_action( 'bp_signup_validate', 'strong_username');
    
     function valid_username($candidate) {
       $r1='/[A-Z]/';  //Uppercase 
       $r2='/[a-z]/';  //lowercase
       $r3='/[0-9]/';  //numbers
    
       if(preg_match_all($r1,$candidate, $o)<1) return FALSE;
       if(preg_match_all($r2,$candidate, $o)<1) return FALSE;
       if(preg_match_all($r3,$candidate, $o)<1) return FALSE;
       if(strlen($candidate)<8) return FALSE;
    
       return TRUE;
    }
    // Force Strong Password
    function strong_validation() {
     global $bp;
    
     if ( !empty( $_POST['signup_password'] ) )
       if ( !valid_pass( $_POST['signup_password'] ) ){
        $bp->signup->errors['signup_password'] = __( 'Your password is too weak or short. Please, use uppercase, lowercase, numbers and special characters.', 'bp-strong-username-password', 'buddypress' );
       }
     }
     add_action( 'bp_signup_validate', 'strong_validation');
    
     function valid_pass($candidate) {
       $r1='/[A-Z]/';  //Uppercase
       $r2='/[a-z]/';  //lowercase
       $r3='/[!@#$%^&*()-_=+{};:,?<.>]/';  // whatever you mean by special char
       $r4='/[0-9]/';  //numbers
    
       if(preg_match_all($r1,$candidate, $o)<1) return FALSE;
       if(preg_match_all($r2,$candidate, $o)<1) return FALSE;
       if(preg_match_all($r3,$candidate, $o)<1) return FALSE;
       if(preg_match_all($r4,$candidate, $o)<1) return FALSE;
       if(strlen($candidate)<10) return FALSE;
    
       return TRUE;
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar