Skip to:
Content
Pages
Categories
Search
Top
Bottom

letter limit on user names

  • @rossb

    Member

    Can a letter limit be set for forum user names (say, 16 letters) to prevent people choosing very long user names?

    Cheers

    Ross

Viewing 10 replies - 1 through 10 (of 10 total)
  • @_ck_

    Participant

    That’s another one of those silly things that got carried over from WordPress. The database limits it to 60 characters and the default template limits it to 30 characters but it’s still overly long.

    Fortunately in bbPress (unlike WordPress) the registration form is done in a template and not in the core, so the easiest way is just to modify the register.php template under my-templates (or copy it from bb-templates) and change the line that looks like this:

    <td><input name="user_login" type="text" id="user_login" size="30" maxlength="30" value="<?php if (1 != $user_login) echo $user_login; ?>" /></td>

    And instead of 30, make it the size limit you want.

    However people that are sneaky and bypass the registration form can still make it 60 characters (ie. spammers). But they will stick out, so you’ll notice it right away.

    This can be fixed via a plugin but it would be way too much code to justify the fix. The template method is best.

    @rossb

    Member

    Thanks, _ck_. Appreciate your prompt response.

    @chrishajer

    Participant

    You can also add

    overflow: hidden;

     

    to the .threadauthor section of your CSS. That just hides any portion of their username that is wider than the space in your template. This forum template is like that.

    @rossb

    Member

    OK! That sounds like a good solution – thanks Chris.

    @rossb

    Member

    _ck_,

    May I seek some clarification re your post above, please?

    With that line in the register.php template, to reduce the max letter limit lower than 30, would I change both references to “30”? That is:

    size=”30″ AND maxlength=”30″?

    Or just maxlength=”30″.

    Cheers

    Ross

    @chrishajer

    Participant

    “Size” is the display width of the field in characters.

    “Maxlength” prevents you from typing in more than that many characters. The browser honors that and prevents more than that characters from being entered in the field. There are ways around this, but if you’re not in a hostile environment, and it’s all people from your organization, then lowering the maxlength just serves as a reminder to use a shorter name.

    @rossb

    Member

    Righto – thanks, Chris. So, probably best to change both to the same number.

    @anautiyal

    Member

    Hi, would someone please lemme know, just like setting the max length of the username, is there a way to set the minimum length of the username; this is to restrict users from selecting very short usernames like 1 or 2 characters long.

    Thx,

    Nauti…

    @dawormie

    Member

    A stab in the dark here… tried

    minlength=”6″

    Assuming you want 6 characters as a minimum?

    @anautiyal

    Member

    Hi Dawormie,

    minlength=”6″ wont work, i have already tried it. Please do let me know if you come across with someother way.

    Thanx

    Nauti…

Viewing 10 replies - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.
Skip to toolbar