How to Increase the Subject Length in phpBB

The default subject box length in phpBB is WAY too short at only 60 characters! Here's how to increase it in three easy steps:

1. Modify the code

First, you'll need to change the code so that it won't be truncated. In the phpBB directory go to the forums sub-directory and open functions_posting.php. Search for $subject = truncate_string. This should bring you to about line 1657, depending on whether you've made any other modifications and also on what version you are using.

Now change the text inside the parentheses from ($subject) to ($subject,125). This will allow you to enter subjects up to 125 characters long. You can use any number under 251, but I recommend 125 because it's more than twice as long as the existing subject and it is, after all, a subject line, not a mini-post! :) You cannot exceed 251 characters because that's what is set in the database. If you want to exceed that, you'll have to change the database as well... which is another topic entirely! The reason it is 251 and not 255 is that you need to accommodate the four characters 'Re: ' for replies.

2. Modify the form

Now you'll need to modify the form so that you can actually send a longer string to the script for processing. The exact location of your form may vary based on the template you are using, but it will probably be some variation on the following (within your phpBB directory): styles/prosilver/template/posting_editor.html. The "prosilver" part is probably the only portion which will vary.

Once you've figured out which is the appropriate file, open it and search for <input type="text" name="subject". You'll see that the maxlength is set to 60 if a new message and 64 otherwise. Change these numbers to 125 and 129 (or whatever you chose above). Make sure you are changing the maxlength numbers and not the "size" number—if you change the size number all it will do is change the look of your form, which you probably don't want to do!

3. Delete the cache

phpBB creates cache files the first time any forum page is viewed and these cache files are used instead of the original files until you manually delete them. So after making the changes above, you'll need to delete the cache files to actually see a difference. Go to the cache sub-directory in your forums directory and just delete all the ctpl and tpl files—it's easier than figuring out which ones need to be deleted individually!