Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: Pawan on January 11, 2010, 11:58:07 PM

Title: How to increase the Subject length
Post by: Pawan on January 11, 2010, 11:58:07 PM
How to increase the Subject length in SMF RC2
Title: Re: How to increase the Subject length
Post by: shadow82x on January 12, 2010, 12:10:54 AM
What specially do you want to change here? Mind attaching a screenshot?
Title: Re: How to increase the Subject length
Post by: Pawan on January 12, 2010, 12:31:22 AM
File attached
Title: Re: How to increase the Subject length
Post by: hadesflames on January 12, 2010, 12:32:31 AM
Do you mean the length of the text box, or the length of the amount of characters allowed in the subject?
Title: Re: How to increase the Subject length
Post by: Pawan on January 12, 2010, 12:37:23 AM
Length of the amount of characters allowed in the subject?
Title: Re: How to increase the Subject length
Post by: hadesflames on January 12, 2010, 12:48:11 AM
I guess you just want to increase the size of the text box =]

Go to ./Themes/{your_theme}/Post.template.php

search for "// Now show the subject box for this post." then look at <input type="text" name="subject"', $context['subject'] == '' ? '' : ' value="' . $context['subject'] . '"', ' tabindex="', $context['tabindex']++, '" size="80" maxlength="80" class="input_text" />

and change the size="80" to the size you want for the box.
Title: Re: How to increase the Subject length
Post by: SoLoGHoST on January 12, 2010, 12:50:04 AM
Ok, there are currently a max of 255 characters in length for this.  If you want more, you'll have to change (in the SMF messages table) the subject column type from varchar to text.  Since varchar only supports up to 255 character lengths.  So change this to a text field, and than in Subs-Post.php look within the createPost function, change string-255 within the insert (in createPost), where ### = the number of character length you'd like.

Good Luck,
Solomon

EDIT:  Out of all of the mods that there are for SMF, I wouldn't be surprised if there was 1 that already did this.
Title: Re: How to increase the Subject length
Post by: Jade Elizabeth on January 12, 2010, 12:52:33 AM
Quote from: SoLoGHoST on January 12, 2010, 12:50:04 AM
Ok, there are currently 255 character length.  If you want more, you'll have to change (in the SMF messages table) the subject column type from varchar to text.  Since varchar only supports up to 255 character lengths.  So change this to a text field, and than in Subs-Post.php look within the createPost and modifyPost functions, change string-255 within the insert (in createPost) and update (in modifyPost) queries to string-###, where ### = the number of character length you'd like.

Good Luck,
Solomon


Last time I checked that was the database size. The max you could enter in the field was 80 I believe. I personally had issues and had to go into the template to edit it.

I cannot for the life of me remember what it was....and I edited RC1.2 not RC2. I think that's the issue here too :).
Title: Re: How to increase the Subject length
Post by: hadesflames on January 12, 2010, 01:01:00 AM
Well, next to size in the input field I described above, there is the maxsize option, which can be changed too. Although I'm not sure if there are any javascript checks for the max length (most likely are) so you might have to do some searching in the JS too.
Title: Re: How to increase the Subject length
Post by: SoLoGHoST on January 12, 2010, 01:05:39 AM
I'm sorry, my bad, go in Post.php.

FIND:
// Make sure the subject isn't too long - taking into account special characters.
if ($smcFunc['strlen']($form_subject) > 100)
$form_subject = $smcFunc['substr']($form_subject, 0, 100);


AND FIND:
// At this point, we want to make sure the subject isn't too long.
if ($smcFunc['strlen']($_POST['subject']) > 100)
$_POST['subject'] = $smcFunc['substr']($_POST['subject'], 0, 100);


Change 100 in both of these searches up to 255 characters.  If you want more than 255, than change the subject column in messages table from varchar to text.  If you do want more than 255 characters, than you'll need to make the edit to Subs-Post in the createPost function that I mentioned, otherwise, if it's <= 255 character length, don't bother with this edit in Subs-Post.php.
Title: Re: How to increase the Subject length
Post by: Pawan on January 12, 2010, 01:12:34 AM
I counted the subject field length it is 80 charr only so which file to edit Post.php. or Post.template.php
Title: Re: How to increase the Subject length
Post by: SoLoGHoST on January 12, 2010, 01:12:43 AM
And also, don't forget in Post.template.php to change the maxlength="80" in here to the maximum number of character length you want:

<input type="text" name="subject"', $context['subject'] == '' ? '' : ' value="' . $context['subject'] . '"', ' tabindex="', $context['tabindex']++, '" size="80" maxlength="80" class="input_text" />
Title: Re: How to increase the Subject length
Post by: SoLoGHoST on January 12, 2010, 01:14:04 AM
Quote from: pawan2002 on January 12, 2010, 01:12:34 AM
I counted the subject field length it is 80 charr only so which file to edit Post.php. or Post.template.php

You need to edit both.
Title: Re: How to increase the Subject length
Post by: Pawan on January 12, 2010, 01:25:07 AM
I changed in  Post.template.php to 150 char and it is working fine without editing Post.php.
Should i edit it or not as forum is working fine.
Title: Re: How to increase the Subject length
Post by: SoLoGHoST on January 12, 2010, 01:28:35 AM
Quote from: pawan2002 on January 12, 2010, 01:25:07 AM
I changed in  Post.template.php to 150 char and it is working fine without editing Post.php.
Should i edit it or not as forum is working fine.
If you don't do the edits in Post.php, it will only grab the first 100 characters from the subject that you type in.  So it's up to you really.

P.S. -> Please Mark Topic Solved if you are satisfied with the help in here.  Thanks :)
Title: Re: How to increase the Subject length
Post by: Pawan on January 12, 2010, 01:39:07 AM
Thanks man !
Title: Re: How to increase the Subject length
Post by: SoLoGHoST on January 12, 2010, 01:52:52 AM
You're welcome and sorry bout the other post.  Was thinking too far ahead there as I've got a million and 1 things on my mind right now :-[
Title: Re: How to increase the Subject length
Post by: Pawan on January 12, 2010, 02:24:37 AM
No prob man Making mistake is human nature ,,just take good sleep. :D
Title: Re: How to increase the Subject length
Post by: Gà Mái on May 01, 2012, 03:26:54 AM
thanks, mark to find later when i need ^^