![]() |
Replace threadpost characters
Recently I was in search of a way to replace or restrict the use of non-alpha characters used in thread titles. This is useful when adding your thread titles to a welcome header or other area where these characters would look out of place (i.e. '!' or '?' placed mid sentence).
The following is a manual addition of code which will replace specified characters with whatever you want. Start by finding /includes/class_dm_threadpost.php You may want to make a backup copy of this file in case you blow things up :eek: Open class_dm_threadpost.php in an editor and find the following code: Code:
// replace html-encoded spaces with actual spaces Code:
$title = preg_replace('/[\?\!]/', ' ', $title); Between the [brackets] only add the characters you wish to have replaced when a user types it into their thread title. Separate each character with a backslash. I personally didn't want to see anything except alpha-numeric titles so I included just about every character. The first part replaces the specified character with a space. The next part I added replaces each specific character with a corresponding word (i.e. '&' is replaced by the word 'and'). Below: Code:
// replace html-encoded spaces with actual spaces Code:
// replace special characters with actual spaces |
Nice work, i think i may leave this for now tho. dont feel like editing any core files currently lol
|
Good Concept. Thanks.
|
works on 3.7.
thanks |
All times are GMT. The time now is 02:31 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|