Advertisement:

Author Topic: How to increase the Subject length  (Read 7403 times)

Offline Pawan

  • Jr. Member
  • **
  • Posts: 241
  • Gender: Male
    • @pawan2002 on Twitter
    • Pawan
How to increase the Subject length
« on: January 11, 2010, 11:58:07 PM »
How to increase the Subject length in SMF RC2

Offline shadow82x

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 11,279
  • Gender: Male
    • cmblaber on LinkedIn
Re: How to increase the Subject length
« Reply #1 on: January 12, 2010, 12:10:54 AM »
What specially do you want to change here? Mind attaching a screenshot?
Colin B
Former Spammer, Customize, & Support Team Member

Offline Pawan

  • Jr. Member
  • **
  • Posts: 241
  • Gender: Male
    • @pawan2002 on Twitter
    • Pawan
Re: How to increase the Subject length
« Reply #2 on: January 12, 2010, 12:31:22 AM »
File attached

Offline hadesflames

  • SMF Hero
  • ******
  • Posts: 2,773
  • Gender: Male
  • C++ Coder
Re: How to increase the Subject length
« Reply #3 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?

Offline Pawan

  • Jr. Member
  • **
  • Posts: 241
  • Gender: Male
    • @pawan2002 on Twitter
    • Pawan
Re: How to increase the Subject length
« Reply #4 on: January 12, 2010, 12:37:23 AM »
Length of the amount of characters allowed in the subject?

Offline hadesflames

  • SMF Hero
  • ******
  • Posts: 2,773
  • Gender: Male
  • C++ Coder
Re: How to increase the Subject length
« Reply #5 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
Code: [Select]
<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.

Offline SoLoGHoST

  • SMF Hero
  • ******
  • Posts: 1,796
  • Gender: Male
  • Real coders do not need to comment their code!
    • Dream Portal
Re: How to increase the Subject length
« Reply #6 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.
« Last Edit: January 12, 2010, 01:19:16 AM by SoLoGHoST »

Offline Jade Elizabeth

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 12,685
  • Gender: Female
  • Keep your enemies close and your friends closer ;)
    • jadetrainor on LinkedIn
    • @alundra on Twitter
    • Jades-World
Re: How to increase the Subject length
« Reply #7 on: January 12, 2010, 12:52:33 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 :).
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

Offline hadesflames

  • SMF Hero
  • ******
  • Posts: 2,773
  • Gender: Male
  • C++ Coder
Re: How to increase the Subject length
« Reply #8 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.

Offline SoLoGHoST

  • SMF Hero
  • ******
  • Posts: 1,796
  • Gender: Male
  • Real coders do not need to comment their code!
    • Dream Portal
Re: How to increase the Subject length
« Reply #9 on: January 12, 2010, 01:05:39 AM »
I'm sorry, my bad, go in Post.php.

FIND:
Code: [Select]
// 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:
Code: [Select]
// 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.
« Last Edit: January 12, 2010, 01:26:49 AM by SoLoGHoST »

Offline Pawan

  • Jr. Member
  • **
  • Posts: 241
  • Gender: Male
    • @pawan2002 on Twitter
    • Pawan
Re: How to increase the Subject length
« Reply #10 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

Offline SoLoGHoST

  • SMF Hero
  • ******
  • Posts: 1,796
  • Gender: Male
  • Real coders do not need to comment their code!
    • Dream Portal
Re: How to increase the Subject length
« Reply #11 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:

Code: [Select]
<input type="text" name="subject"', $context['subject'] == '' ? '' : ' value="' . $context['subject'] . '"', ' tabindex="', $context['tabindex']++, '" size="80" maxlength="80" class="input_text" />

Offline SoLoGHoST

  • SMF Hero
  • ******
  • Posts: 1,796
  • Gender: Male
  • Real coders do not need to comment their code!
    • Dream Portal
Re: How to increase the Subject length
« Reply #12 on: January 12, 2010, 01:14:04 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.

Offline Pawan

  • Jr. Member
  • **
  • Posts: 241
  • Gender: Male
    • @pawan2002 on Twitter
    • Pawan
Re: How to increase the Subject length
« Reply #13 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.

Offline SoLoGHoST

  • SMF Hero
  • ******
  • Posts: 1,796
  • Gender: Male
  • Real coders do not need to comment their code!
    • Dream Portal
Re: How to increase the Subject length
« Reply #14 on: January 12, 2010, 01:28:35 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 :)
« Last Edit: January 12, 2010, 01:32:20 AM by SoLoGHoST »

Offline Pawan

  • Jr. Member
  • **
  • Posts: 241
  • Gender: Male
    • @pawan2002 on Twitter
    • Pawan
Re: How to increase the Subject length
« Reply #15 on: January 12, 2010, 01:39:07 AM »
Thanks man !

Offline SoLoGHoST

  • SMF Hero
  • ******
  • Posts: 1,796
  • Gender: Male
  • Real coders do not need to comment their code!
    • Dream Portal
Re: How to increase the Subject length
« Reply #16 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 :-[

Offline Pawan

  • Jr. Member
  • **
  • Posts: 241
  • Gender: Male
    • @pawan2002 on Twitter
    • Pawan
Re: How to increase the Subject length
« Reply #17 on: January 12, 2010, 02:24:37 AM »
No prob man Making mistake is human nature ,,just take good sleep. :D

Offline Gà Mái

  • Jr. Member
  • **
  • Posts: 258
  • Gender: Female
Re: How to increase the Subject length
« Reply #18 on: May 01, 2012, 03:26:54 AM »
thanks, mark to find later when i need ^^
-- I love SMF --