phpBBHacks.com - Increase Possible Subject Length
YanksBlog.com, an unofficial New York Yankees fan blog
StatsForums Home   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in
FAQFAQ   SearchSearch   MemberlistMemberlist   TutorialsTutorials   ContactContact Us
Add Us:     MySpace     Facebook     StumbleUpon
Username:    Password:
Remember Me?    
Increase Possible Subject Length
BlinkList
del.icio.us
Furl
linkaGoGo
reddit
Simpy
Mister Wong
Yahoo! My Web

Post new topic   Reply to topic    phpBBHacks.com Support Forums Forum Index -> phpBB 2: Customizing Your phpBB
 See a User Guidelines violation? Please contact us.
Author Message

Thoul
VIP

Joined: 30 Jul 2002
Posts: 17676
Location: USA

PostPosted: April 22nd 2004, 12:23 pm    Post subject: Increase Possible Subject Length Reply with quote

By default, phpBB limits the length of post and topic subjects to 60 characters. On some forums, it is desirable to allow longer subjects, so this is a guide to hacking your phpBB to increase the limit. We will use 120 as the new subject length here, but you can use a different number by simply changing 120 to that number in the instructions that follow.

Before beginning, let me point out some limitations of this guide and the methods we will be using. The maximum subject length allowed by the MySQL database software is 255 characters, and this cannot be exceeded by the methods we will be using (I'll show you how to have longer subjects later). Other database management software (DBMS) may have different character limits. We will also be using SQL queries to alter the database tables. These queries are written for use in MySQL. If you are using another DBMS, you may need to edit the queries before you can use them. Now, on to the hacking!

There are two steps to increasing the subject length. First you need to run a couple of SQL queries, and you can do this using a database utility like phpMyAdmin or a db_update.php file. If you use phpMyAdmin, you may need to change the phpbb_ prefix of the database table names in these queries. The db_update.php file will handle that automatically.
Code:
ALTER TABLE phpbb_posts_text CHANGE post_subject post_subject VARCHAR(120) DEFAULT NULL;
ALTER TABLE phpbb_topics CHANGE topic_title topic_title VARCHAR(120) NOT NULL;


The second step is to edit the posting_body.tpl file of each template installed on your forum. You need to find a certain line in this file, but as you may know, different templates tend to use very different coding. Below, you can see what the line looks like in subSilver.
Code:
<input type="text" name="subject" size="45" maxlength="60" style="width:450px" tabindex="2" class="post" value="{SUBJECT}" />


If you cannot find this exact line, try looking for a line containing name="subject", name=subject, or name='subject'. All of these would be valid, but you'll probably only see the first version in use. Now, check that line to see if in contains the text maxlength="60" (or a variation of it with single or no quotation marks). If you find the line does not contain the maxlength attribute, you can either skip this step for the template you are editing or add the attribute. Now, assuming that the maxlength attribute is there, change the 60 to 120. Here is the subSilver line with this change.
Code:
<input type="text" name="subject" size="45" maxlength="120" style="width:450px" tabindex="2" class="post" value="{SUBJECT}" />


Now your posters can enter subject lines of greater length when making, editing, or replying to posts and private messages.

(As an aside, those familiar with how posting_body.tpl may wonder why we didn't also alter the private message database tables. It isn't necessary, as they already allow subject lengths of up to 255 characters. The 60 character limit is imposed on private messages only by posting_body.tpl.)
Back to top
View user's profile Send private message Visit poster's website

Thoul
VIP

Joined: 30 Jul 2002
Posts: 17676
Location: USA

PostPosted: April 22nd 2004, 12:39 pm    Post subject: Reply with quote

I mentioned before that there is a 255 character limit when changing the allowed subject length with the method described above. There is one way to exceed this length, but you must be careful when using it. This alternate method allows subjects that can potentially be much longer (as long as the body of an actual post).

To use this method, you need to run a different set of SQL queries (if you've already run those above, that's fine). A third query is included here for private message subjects. If you want to keep those at the default limit (see the note at the end of the above post), skip that query. MySQL users can replace TEXT with TINYTEXT in these queries for shorter (but still very long) subject allowances.
Code:
ALTER TABLE phpbb_posts_text CHANGE post_subject post_subject TEXT DEFAULT NULL;
ALTER TABLE phpbb_topics CHANGE topic_title topic_title TEXT NOT NULL;
ALTER TABLE phpbb_privmsgs CHANGE privmsgs_subject privmsgs_subject TEXT NOT NULL;


The second step is essentially identical to that of the first method. You need to find and change the maxlength attribute to a larger number as described there. The number you use will be the maximum limit of subjects allowed from the posting form. If there is not a maxlength attribute, I strongly suggest adding one, as there will be little other limitations on the subject length. The DBMS will have its own set limit, but that is a very high limit.
_________________
Phantasy Star: The Fringes of Algo

Install, remove, or upgrade SQL with Advanced DB Update Generator! Now with phpBB 3 Support!

My phpBB Books, Hacks, and Other Works «·» 70+ Listings @ phpBBHacks.com
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    phpBBHacks.com Support Forums Forum Index -> phpBB 2: Customizing Your phpBB All times are GMT - 6 Hours
Page 1 of 1
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Links: Big Message Boards - Free JavaScript - phpBB2 - phpbb styles - Suporte phpBB - phpBB.it - phpBB Česky - phpBB Turkiye - phpBBArabia.com - phpBB-fr.com - Romanian phpBB online community - phpBB-TW.net - phpBBservice.nl - phpBB Brasil

Network: iFroggy Network Blog - iFroggy Hosting - SportsForums.net - KarateForums.com - YanksBlog.com - DeveloperCube - Managing Online Forums - ManagingCommunities.com - CommunityAdmins.com - PhotoshopForums.com - MicrosoftBlog.com - DrGregHouse.com - Bad Boy Blog - BadBoyForums.com - SodaRatings.com - Patrick O'Keefe

< Advertising - Contact Us - Staff - User Guidelines >

Copyright © 2001-2008. iFroggy Network, phpBBHacks.com. All Rights Reserved. Privacy Policy. We Support phpBBHacks.com (of course!).
Powered by phpBB © phpBB Group. phpBB SEO. Hosted by 100MegsWebHosting. We are in no way affiliated with the phpBB Group. phpBB is copyright to the phpBB Group.