Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Discussion Topic Length > 100

edited September 2007 in Vanilla 1.0 Help
Hello everybody,

I am using Vanilla 1.1.2 for a forum listing concerts in the North of Germany. The discussion topic holds all band-names, the date, and the venue + city the concert is taking place in. As you can imagine, having 4 bands play in one venue, quickly makes the Discussion Topic reach the 100 character limit of the 'Discussion Topic' field.

When I went in and changed the HTML maxlength attribute in the /themes/discussion_form.php file, i got errors all over the place, and the Discussion was not posted. So, I went looking, and in the Vanilla Wiki FAQ on this question it says this:
Is it possible to configure the "discussion topic" field to accept a larger amount of input?
There is no administrative option to achieve this, but you could do it with an extension.
But there are no extensions available that I could find that achieve this. Since I am capable of reading PHP, but unfortunately not of writing it, I really can't make such an extension myself. So my question is: Does anybody know how to increase the maximum length of the Discussion Topic field, either by an extension or by manually altering the PHP file?

As you understand, my forum isn't worth very much with this limitation in place.
I would be very much obliged, and could offer my skills as Graphical- and Webdesigner and CSS-jockey in return.

Mark.

Comments

  • You're on the right track, there are just other places to also change the length. I suspect the errors were that the database topic field is also limited to 100 characters.

    It should be fairly easy to manage the database and change the column size if you have raw database access like PhpMyAdmin. If it still doesn't work, post the error messages and that will help point to other places where the size needs to be adjusted.

    You might also want to look into using other workarounds--like putting all the venue information in the body of the discussion and using Discussion Excerpt to show that info on the main page, or even using the Blog add-on to make a dedicated concert listing tab.
  • Ah, so can you tell me where the values are that I should change? I do have raw database access through PHPMyAdmin. I'm going to experiment a little bit, see if I can find the value that you speak of, but any more help would be highly appreciated.
  • edited October 2007
    I changed the 'Name' value in the LUM_Discussion table into this: varchar(200)

    *Edit*
    Removed errors, because they were caused by the 'David'-plugin and have nothing to do with this issue.
    */Edit*
  • I'm not sure why you are getting those errors... Perhaps the Vanilla.Class.Discussion.php or the Vanilla.Control.CommentGrid.php file got corrupted? Try uploading those and any others you might have changed fresh.

    I tried editing my own install to see what needs to be changed, first thing was to change the max length in the HTML in themes/discussion_form.php, then I changed the database and tried posting but got just the single error message "Discussion topic is 50 characters too long".

    So I edited my library/Vanilla.Class.DiscussionManager.php, and in there about line 430 is a Validate function that checks the length. Set that to 200, and successfully started a discussion.
  • Oh yeah! WallPhone, you rock!

    I found the Validation in line 419, but since it was the only instance of the number 100 in the entire file, i changed that to see what it did, and it worked!
  • And for all of you that want to change the maximum Discussion Topic length, here's a re-cap for you. This of course assumes you want to set the length to 200. No idea on how it works when you set it to eight gazillion, but in theory the database should take it. (Or so I've heard...)
    1. In the file /themes/discussion_form.php change this:
      ... class="DiscussionBox" maxlength="100" value="'.$Discussion->Name.'" ...
      into this:
      ... class="DiscussionBox" maxlength="200" value="'.$Discussion->Name.'" ...
      It is generally recommended to copy the file into your own Theme folder, so that when you update your installation you won't end up with the old limit again.

    2. Change /library/Vanilla/Vanilla.Class.DiscussionManager.php where it says:
      Validate($this->Context->GetDefinition('DiscussionTopicLower'), 1, $Name, 100, '', $this->Context);
      into this:
      Validate($this->Context->GetDefinition('DiscussionTopicLower'), 1, $Name, 200, '', $this->Context);

    3. In the database, change the value of the 'Name' value in the 'LUM_Discussion' table into this: varchar(200)
This discussion has been closed.