Firefox PHP

format_functions module only active on initial post

Posted by emphyrio61 
format_functions module only active on initial post
May 14, 2019 03:15PM
I altered the format_functions.php file a little to replace some words used in my forum to links to my website. To do this I added this code to the format_functions.php file:

// Work on the message body ========================

if (isset($message["body"]))
$body = $message["body"];

// Convert legacy <> urls into bare urls.
$body = preg_replace("/<((http|https|ftp):\/\/[a-z0-9;\/\?:@=\&\$\-_\.\+!*'\(\),~%]+?)>/i", "$1", $body);

// Escape special HTML characters.
$escaped_body = htmlspecialchars($body, ENT_COMPAT, $PHORUM["DATA"]["HCHARSET"]);


$pattern[0]="my search word"; $replacement[0]="link to a page on my site";
$pattern[1]="my other search word"; $replacement[1]="link to an other page on my site";

$replaced_body = str_replace($pattern, $replacement, $escaped_body);

if($replacecount == 0){

if($replaced_body != $escaped_body){
$escaped_body = $replaced_body;


Now this works fine for the initial posts, but it does not work on the replies. How can i do the same to the replies?

BR, Emphyrio61

Edited 1 time(s). Last edit at 05/14/2019 03:16PM by emphyrio61.
Sorry, only registered users may post in this forum.

Click here to login