Customizing SMF > SMF Coding Discussion
Adding filter when posting
simzman:
Hi,
I'd like to add this
--- Code: ---<?php
$text = preg_replace('~\s{2,}~', ' ', $text);
?>
--- End code ---
To run when you have written your post and are clicking 'send' to remove any double spacing.
However, I can't figure out where to insert the code so that it runs as you click post.
Thank you in advance.
Orangine:
use censor instead :)
simzman:
Thanks Orangine,
I will add a censor - and that will fix some instances. But the main reason for doing this is once the posts has been submitted, doubles spaces become: [space]+[ ]
I have censors for   however in most cases they are up against other words and cannot be pick up and removed. This is the major problem. Many posts with   throughout other words. A lot of maintenance. Was aiming to intercept the message prior to it being 'sent' or posted.
Many thanks for your quick response and help!
Perhaps you or others have had a similar problem? Haven't found a solution of SMF forums as yet.
Orangine:
ok, got it now
look into ./Sources/Subs-Post.php and search for $mistake_fixes = array(
simzman:
Excellent, will try it and keep you posted.
:D
Navigation
[0] Message Index
[#] Next page
Go to full version