Skip to:
Content

BuddyPress.org

Ticket #5185: 5185.patch

File 5185.patch, 2.3 KB (added by boonebgorges, 11 years ago)
  • new file p-core/deprecated/1.9.php

    diff --git bp-core/deprecated/1.9.php bp-core/deprecated/1.9.php
    new file mode 100644
    index 0000000..ffe869f
    - +  
     1<?php
     2/**
     3 * Deprecated Functions
     4 *
     5 * @package BuddyPress
     6 * @subpackage Core
     7 * @deprecated Since 1.9
     8 */
     9
     10/**
     11 * Strips spaces from usernames that are created using add_user() and wp_insert_user()
     12 *
     13 * @package BuddyPress Core
     14 * @deprecated BuddyPress (1.9)
     15 */
     16function bp_core_strip_username_spaces( $username ) {
     17        _deprecated_function( __FUNCTION__, '1.9' );
     18
     19        // Don't alter the user_login of existing users, as it causes user_nicename problems.
     20        // See http://trac.buddypress.org/ticket/2642
     21        if ( username_exists( $username ) && ( !bp_is_username_compatibility_mode() ) )
     22                return $username;
     23
     24        return str_replace( ' ', '-', $username );
     25}
     26
  • bp-members/bp-members-functions.php

    diff --git bp-members/bp-members-functions.php bp-members/bp-members-functions.php
    index 9289d1a..49a35dd 100644
    function bp_core_ucfirst( $str ) { 
    945945}
    946946
    947947/**
    948  * Strips spaces from usernames that are created using add_user() and wp_insert_user()
    949  *
    950  * @package BuddyPress Core
    951  */
    952 function bp_core_strip_username_spaces( $username ) {
    953         // Don't alter the user_login of existing users, as it causes user_nicename problems.
    954         // See http://trac.buddypress.org/ticket/2642
    955         if ( username_exists( $username ) && ( !bp_is_username_compatibility_mode() ) )
    956                 return $username;
    957 
    958         return str_replace( ' ', '-', $username );
    959 }
    960 add_action( 'pre_user_login', 'bp_core_strip_username_spaces' );
    961 
    962 /**
    963948 * When a user logs in, check if they have been marked as a spammer. If yes then simply
    964949 * redirect them to the home page and stop them from logging in.
    965950 *
    function bp_core_validate_user_signup( $user_name, $user_email ) { 
    12111196        if ( strpos( ' ' . $user_name, '_' ) != false )
    12121197                $errors->add( 'user_name', __( 'Sorry, usernames may not contain the character "_"!', 'buddypress' ) );
    12131198
     1199        if ( false !== strpos( $user_name, ' ' ) ) {
     1200                $errors->add( 'user_name', __( 'Sorry, usernames may not contain spaces.', 'buddypress' ) );
     1201        }
     1202
    12141203        // Is the user_name all numeric?
    12151204        $match = array();
    12161205        preg_match( '/[0-9]*/', $user_name, $match );