The MU forums have moved to WordPress.org

enable wildcard illegal_names (8 posts)

  1. athesudden
    Member
    Posted 17 years ago #

    in file /wp-includes/wpmu-functions.php:

    replace:

    if( in_array( $blog_id, $illegal_names ) == true ) {
    $errors->add('blog_id', __("That name is not allowed"));
    }

    with:

    function my_inArray($needle, $haystack) {
    # this function allows wildcards in the array to be searched
    foreach ($haystack as $value) {
    if (true === fnmatch($value, $needle)) {
    return true;
    }
    }
    return false;
    }
    if( my_inArray($blog_id, $illegal_names) == true ) {
    $errors->add('blog_id', __("That name is not allowed"));
    }

    This will enable you to specify wildcards in your banned names lists. ie: *f**k*, *gr[ae]y*

  2. andrea_r
    Moderator
    Posted 17 years ago #

    Oooooo... good idea. Like the array names. ;)

  3. drmike
    Member
    Posted 17 years ago #

    Best bet would be to submit the suggestion to trac.

    Gotta admit though that I disagree with this idea although I see where it would have merit. I have a client with last name that includes one of those choice words as a part of her entire name. She runs into issues all the time when she says her name.

  4. athesudden
    Member
    Posted 17 years ago #

    Besides the client situation you described, I'm curious to learn why else you disagree with this idea?

  5. drmike
    Member
    Posted 17 years ago #

    That's basically it. Again I can see where it would have merit but I feel that it would cause more issues than it would solve.

  6. winpoka
    Member
    Posted 16 years ago #

    This sadly doesn't seem to work anymore - I'm no whiz with PHP though.. does anyone see errors in the above posted code? Shouldn't it just be two == ? I see === at one point?

  7. Trent
    Member
    Posted 16 years ago #

    Winpoka, you can define the illegal names not to be used in your WPMU Site Admin Options page now.

    Trent

  8. freshestnoob
    Member
    Posted 16 years ago #

    @winpoka

    == means 'equal to'

    === means 'equal to and of the same type'

    I hope I got it right. I'm just too lazy to crosscheck in the php docs.

About this Topic

  • Started 17 years ago by athesudden
  • Latest reply from freshestnoob