Tips How to Increase Character Limit for Forum Nodes and Titles in Xenforo 2

Compatible XF 2.x versions
  1. 2.x
Hello everyone, today I'm going to guide you on how to increase the character limit for categories and post titles in Xenforo.

By default, Xenforo only supports 50 characters for categories and 150 characters for post titles. If you exceed these limits, an error will be displayed

Oops! We ran into some problems. Please enter a value using 50 characters or fewer.
To increase the number of characters, go to phpMyAdmin > SQL and run the following command
SQL:
ALTER TABLE `xf_node` CHANGE COLUMN `title` `title` VARCHAR(500), CHANGE COLUMN `node_name` `node_name` VARCHAR(500);
ALTER TABLE `xf_thread` MODIFY title varchar(500);
ALTER TABLE `xf_forum` MODIFY last_thread_title varchar(500);
Screenshot_70.png

Go to /src/XF/Entity/Node.php
Find
PHP:
$structure->columns = [
            'node_id' => ['type' => self::UINT, 'autoIncrement' => true, 'nullable' => true],
            'title' => ['type' => self::STR, 'maxLength' => 50,
                'required' => 'please_enter_valid_title', 'api' => true
            ],
            'node_name' => ['type' => self::STR, 'maxLength' => 50, 'nullable' => true, 'default' => null,
                'unique' => 'node_names_must_be_unique',
                'match' => self::MATCH_ALPHANUMERIC_HYPHEN,
                'api' => true
            ],
And change 50 to 500

Go to /src/XF/Entity/Thread.php
Find
PHP:
$structure->columns = [
            'thread_id' => ['type' => self::UINT, 'autoIncrement' => true, 'nullable' => true],
            'node_id' => ['type' => self::UINT, 'required' => true, 'api' => true],
            'title' => ['type' => self::STR, 'maxLength' => 150,
                'required' => 'please_enter_valid_title',
                'censor' => true,
                'api' => true,
            ],
And change 150 to 500

Go to /src/XF/Entity/Forum.php
Find
PHP:
'last_thread_title'           => ['type' => self::STR, 'maxLength' => 150, 'default' => ''],
Change 150 to 500

That's it.
Good luck!
 

Similar threads

October 2024

Total amount
$160.50
Goal
$400.00
Donation ends:

Staff online

Forum statistics

Threads
10,651
Messages
28,709
Members
48,020
Latest member
lazersate
Top