lowering custom title character limit?

dark_night

Well-known member
Registered
Joined
Jul 28, 2020
Messages
149
Points
53

Reputation:

how can i change the max characters for a users custom title? currently its 50 but want to decrease it, cant seem to find any solution online

is it as simple as changing:

maxlength="{{ max_length($xf.visitor, 'custom_title') }}"

to

maxlength="25"

or will there need to be further modification/better way to handle this?

thanks a lot
 

jim

Well-known member
Registered
Joined
Aug 20, 2021
Messages
131
Points
38

Reputation:

you can try modifying the value of the maxlength attribute of the HTML input element that is used to input the custom user title. In the example you provided, you can simply change the value of maxlength from {{ max_length($xf.visitor, 'custom_title') }} to 25.

That being said, it's important to note that simply modifying the maxlength attribute in the HTML code may not be sufficient to fully change the maximum length of the custom user title. This is because the maximum length of the custom user title may also be enforced on the server side by the forum software itself. In order to fully change the maximum length of the custom user title, you will likely need to modify the relevant server-side code as well.

Without more information about your specific setup and how your forum is configured, it's difficult to provide more specific instructions on how to change the maximum length of the custom user title.
 

thomsa

Moderator
Staff member
Moderator
S.V.I.P Member
Collaborate
Registered
Joined
Jun 22, 2019
Messages
1,169
Points
173

Reputation:

@popwoo to hard edit file /src/XF/Entity/User.php

line 2177

'custom_title' => ['type' => self::STR, 'maxLength' => 50, 'default' => '',

chenge 50 to 25
 
Top