Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter conditionkill

    (@conditionkill)

    Here’s how it looks when someone posts with a really long name..
    Messes up the whole site.. ??
    https://img217.imageshack.us/img217/8884/20090219200735ao4.png

    This should do the trick: in either your themes header.php or functions.php add the following piece of code

    add_filter('get_comment_author',create_function('$author','return substr($author,0,40)');)

    The 40 can be changed to change the maximum limit of the authors name.

    I haven’t tested this myself but it should work!

    Thread Starter conditionkill

    (@conditionkill)

    It works, awesome! Thx alot ;D

    Btw if anyone wanna copy this code there was a small typo, the semicolon in the end was misplaced and the code should be
    add_filter('get_comment_author', create_function('$author','return substr($author,0,25);'))
    If you want it to work ??

    Sorry about the typo! It was written in a bit of a rush but I’m glad it works!

    How does a novice like myself actually add that code? Do I do it like this?

    <?php add_filter(‘get_comment_author’, create_function(‘$author’,’return substr($author,0,25);’))>


    ?????????????

    Do it like this:

    <?php add_filter('get_comment_author', create_function('$author','return substr($author,0,25);')); ?>

    Thank you jcow. I will try that and return with the results.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Character limit on comment author’ is closed to new replies.