subject line

Get help with installation and running phpBB 3.0.x here. Please do not post bug reports, feature requests, or MOD-related questions here.
Ideas Centre
Forum rules
END OF SUPPORT: 1 January 2017 (announcement)
Locked
User avatar
chimp77
Registered User
Posts: 326
Joined: Sat Mar 24, 2007 8:11 pm
Location: Georgia
Contact:

subject line

Post by chimp77 » Thu Mar 18, 2010 12:08 am

Is there a way to adjust the number of characters in the thread subject line? I noticed that there is a limit of how long a subject line can be.
Certified Broadcast Meteorologist - Hurricane Expert

User avatar
Tom
Former Team Member
Posts: 2665
Joined: Tue Jun 20, 2006 2:12 am
Name: Tom Catullo
Contact:

Re: subject line

Post by Tom » Thu Mar 18, 2010 2:06 am

If you're using a prosilver-based style, open the file styles/prosilver/template/posting_editor.html and find this line:

Code: Select all

		<dd><input type="text" name="subject" id="subject" size="45" maxlength="<!-- IF S_NEW_MESSAGE -->60<!-- ELSE -->64<!-- ENDIF -->" tabindex="2" value="{SUBJECT}{DRAFT_SUBJECT}" class="inputbox autowidth" /></dd>
You will see the numbers 60 and 64 in between conditional tags. 60 is the subject line limit when posting a new topic or sending a new PM, and 64 is the subject line limit when posting a reply to a topic or a PM (4 characters difference for the "Re: " in front of the original subject title in replies). Change those numbers to whatever you'd like, then save the file to complete the changes.

Keep in mind, however, that the maximum character length for the subject line cannot exceed 255 characters, even if you set the numbers above 255 in the code I told you to find. This is due to the fact that the subject field in the database has a maxlength of 255 characters. Therefore, if you make the length longer than 255 in that file, only the first 255 of the characters in the subject will be submitted to the database. Just informing you of this beforehand.
Tom Catullo - Former Moderator Team Member
phpBB3 Smiley Pak Generator | Legend Repositioning MOD | My GitHub | My Site

User avatar
chimp77
Registered User
Posts: 326
Joined: Sat Mar 24, 2007 8:11 pm
Location: Georgia
Contact:

Re: subject line

Post by chimp77 » Thu Mar 18, 2010 12:19 pm

Thanks Tom, I am using sub silver 2. I found a quick reply editor where I saw the "64" characters for the "re: ". There was not a posting editor? Any idea what that is named in subsilver2?

thank you!
Certified Broadcast Meteorologist - Hurricane Expert

User avatar
Tom
Former Team Member
Posts: 2665
Joined: Tue Jun 20, 2006 2:12 am
Name: Tom Catullo
Contact:

Re: subject line

Post by Tom » Thu Mar 18, 2010 7:20 pm

For subsilver2, open the file styles/subsilver2/template/posting_body.html and find the following line:

Code: Select all

	<td class="row2" width="78%"><input class="post" style="width:450px" type="text" name="subject" size="45" maxlength="<!-- IF S_NEW_MESSAGE -->60<!-- ELSE -->64<!-- ENDIF -->" tabindex="2" value="{SUBJECT}" /></td>
That is where you can change the subject length for subsilver2. The same 60 and 64 are present there, just in a different context.
Tom Catullo - Former Moderator Team Member
phpBB3 Smiley Pak Generator | Legend Repositioning MOD | My GitHub | My Site

hostsdepot
Registered User
Posts: 5
Joined: Sat Apr 17, 2010 6:48 am
Contact:

Re: subject line

Post by hostsdepot » Sun Apr 18, 2010 3:54 pm

Thank you. It is very useful.

hostsdepot
Registered User
Posts: 5
Joined: Sat Apr 17, 2010 6:48 am
Contact:

Re: subject line

Post by hostsdepot » Mon Apr 19, 2010 8:54 pm

Thanks for the instruction and remember to clear cache file to make it work.

Thanks
Last edited by hostsdepot on Mon Apr 19, 2010 9:00 pm, edited 1 time in total.

Green Light
Registered User
Posts: 224
Joined: Fri Jan 16, 2009 10:10 pm

Re: subject line

Post by Green Light » Mon Apr 19, 2010 9:00 pm

Did you purge the cache?
Purge the cache
Purge all cache related items, this includes any cached template files or queries.
In, ACP >> Index

edit: guess you figured it out, right when i posted.

bawdyn
Registered User
Posts: 2
Joined: Thu Aug 19, 2010 8:40 pm

Re: subject line

Post by bawdyn » Thu Aug 19, 2010 8:46 pm

I made these changes and it did allow me to type in a longer Subject line, but it still truncated it at 60 characters when it stored it to the database. I did the cache purge. So, there must be some other place where this character limit is enforced. I'll look for it, but if anyone has found it already I'd appreciate the info. Thanks.

bawdyn
Registered User
Posts: 2
Joined: Thu Aug 19, 2010 8:40 pm

Re: subject line

Post by bawdyn » Thu Aug 19, 2010 9:15 pm

OK, I found it.

File: includes\functions_posting.php
Line: $subject = truncate_string($subject);
Change to: $subject = truncate_string($subject, 251);

251 is the maximum value as you need room for the 're: ' characters for a reply. Use the smaller of the two numbers you set in the Template. The truncate_string function defaults to 60 characters if you don't add the additional parameter.

User avatar
RiTz21
Registered User
Posts: 208
Joined: Tue May 31, 2005 5:20 pm

Re: subject line

Post by RiTz21 » Tue Dec 07, 2010 7:28 pm

Are these changes 'loss' if you update your version of PHPBB using the automatic updater?

RiTz21
Image

User avatar
Tom
Former Team Member
Posts: 2665
Joined: Tue Jun 20, 2006 2:12 am
Name: Tom Catullo
Contact:

Re: subject line

Post by Tom » Wed Dec 08, 2010 7:19 pm

RiTz21 wrote:Are these changes 'loss' if you update your version of PHPBB using the automatic updater?
No, these changes should not be lost if you update using the automatic updater.
Tom Catullo - Former Moderator Team Member
phpBB3 Smiley Pak Generator | Legend Repositioning MOD | My GitHub | My Site

User avatar
RiTz21
Registered User
Posts: 208
Joined: Tue May 31, 2005 5:20 pm

Re: subject line

Post by RiTz21 » Fri Dec 10, 2010 2:12 pm

Ok I have applied the two changes to my Forum to allow for 124/128 characters, and it works like a charm!!

My Thanks to Tom & bawdyn for sharing their knowledge of this!!

RiTz21
Image

Tony Stark
Registered User
Posts: 516
Joined: Thu Apr 08, 2010 8:22 pm

Re: subject line

Post by Tony Stark » Sun Dec 12, 2010 1:46 pm

i'm confused by this. i replaced 60 and 64 with 251 and 255, and i put 251 after truncate subject, but when i tested it out by typing in a really long subject line, i managed to get only as far as 251 before getting stopped. i thought the 251 limit was only for replies, to make way for "re: ", but that if it was a new subject, it could be 255 in the line.

User avatar
RiTz21
Registered User
Posts: 208
Joined: Tue May 31, 2005 5:20 pm

Re: subject line

Post by RiTz21 » Sun Dec 12, 2010 3:34 pm

Tony Stark wrote:i'm confused by this. i replaced 60 and 64 with 251 and 255, and i put 251 after truncate subject, but when i tested it out by typing in a really long subject line, i managed to get only as far as 251 before getting stopped. i thought the 251 limit was only for replies, to make way for "re: ", but that if it was a new subject, it could be 255 in the line.
It is the other way around: 251 would be the 'limit" for a normal subject, since a 'reply' to that subject would ADD 4 more characters, requiring 255 characters!!

RiTz21
Image

Tony Stark
Registered User
Posts: 516
Joined: Thu Apr 08, 2010 8:22 pm

Re: subject line

Post by Tony Stark » Sun Dec 12, 2010 3:36 pm

RiTz21 wrote:
Tony Stark wrote:i'm confused by this. i replaced 60 and 64 with 251 and 255, and i put 251 after truncate subject, but when i tested it out by typing in a really long subject line, i managed to get only as far as 251 before getting stopped. i thought the 251 limit was only for replies, to make way for "re: ", but that if it was a new subject, it could be 255 in the line.
It is the other way around: 251 would be the 'limit" for a normal subject, since a 'reply' to that subject would ADD 4 more characters, requiring 255 characters!!

RiTz21
ah, so 255 after truncate subject then? and does this work for pms too?

EDIT: got it figured out now. in functions_content.php in the includes folder, replace

Code: Select all

function truncate_string($string, $max_length = 60, $max_store_length = 255, $allow_reply = false, $append = '')
with

Code: Select all

function truncate_string($string, $max_length = 251, $max_store_length = 255, $allow_reply = false, $append = '')

Locked

Return to “[3.0.x] Support Forum”