News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Censored Words

Started by DNAPANDA, January 20, 2009, 06:34:06 AM

Previous topic - Next topic

DNAPANDA

I have searched, but cant find it in messageindex.php or subs-boardindex.php  :-\

fwitt

BoardIndex.php


censorText($row_board['subject']);

DNAPANDA

Works like a dream, thanks a bunch guys!! :D

apostaideal

Quote from: DNAPANDA on February 17, 2009, 02:19:58 PM
Quote from: fwitt on February 17, 2009, 11:06:38 AM
Quote from: DNAPANDA on January 20, 2009, 06:34:06 AM
Hi,

I have a question about the function "Censored Words", is it possible to only censor words in the posts? I dont want to have this function in the topic subject.  ::)

Hope someone can help me with this, thanks.

Forum version: SMF 1.1.7

just had a look and this is surprisingly easy to do.

in Sources/Display.php

comment out the lines


censorText($topicinfo['subject']);


and


censorText($message['subject']);


making them


//censorText($topicinfo['subject']);


and


//censorText($message['subject']);

Great, its getting close now!  :D

It shows the right subject text when you are inside the current subject, but when you are looking at the topic inside the boards and on the forumindex it still shows links in the subject. Where can I change these codes?

Hello,

I don´t have Sources/Display.php in my theme, and I can´t find censorText code in Display.template.php...Where I can find this code?



Thank´s

Arantor

That's because it's not in the template files at all, but the core source files. You're looking at /Themes/yourtheme/Display.template.php, but you have to go up out of the Themes area entirely and into the Sources files, which you cannot directly edit from the web (unless you use the File Management Mod)

apostaideal

Yeh,

That´s worked...

Thank´s  ;D

Doug Varrieur

If anyone can help I'd appreciate it. I'm using version 1.1.11 and I'm running into this problem. Ive made the changes suggested on this post and I'm 90% there...but.... the topic name on the board still shows the URL...when inside the topic it's clean (not censored) but the topic name on the board is still being censored and the URL is present.

I've made these changes, but I'm obviously missing something....any advice??

Code: [Select]
//censorText($topicinfo['subject']);

Code: [Select]
//censorText($message['subject']);

//censorText($row_board['subject']);


kat

Having thought about this, I'd still use the censored words, as-is.

If you censor "Google" and substitute it with

[url=http://www.google.com]Google[/url]

it should do the job.

Google

Doug Varrieur

It Does Kay....works great in the body of the post BUT if you include the word google in the new topic name without making code changes this is what will show up on the board and the topic title

Google

So lets say you post a new topic and call it search with google today what will show on the topic title and board will be

search with Google today

The changes I've already made in the PHP files have solved the subject censoring however the title of the subject on the board is still effected. I need to know what code to change to stop the title name on the board from being censored. I only want to censor the words within the posts.

Any ideas??

Doug Varrieur

NOTE- The red [non-active] would be google in this example, not sure why the red came up  :-\

kat

It's a "Here" thing. ;)

No idea, mate.

That'd need some coding, somewhere. Way out of my league, I'm afraid.

I believe that it'd be quite a difficult thing to achieve, too. Though, I could be wrong.

Doug Varrieur

It seems from the above posts another member resolved the issue. I'm almost there just need to know which Censor code I'm missing.

kat

'course!

Doh!

One thing I noticed, if it helps.

//censorText($topicinfo['subject']);

//censorText($message['subject']);

They didn't comment-out this one: //censorText($row_board['subject']);

Doug Varrieur

No they didn't but I did :)

these are the three I commented out... must be another one somewhere??

//censorText($topicinfo['subject']);

//censorText($message['subject']);

//censorText($row_board['subject']);

Sciamano

Hi!
I'm trying to do the same thing (on SMF 2.0.2) but I'm stuck...
I 've commented out the three lines as above, but still the thread subject gets "censored".
Any help would be appreciated.
Thanks!

Sciamano

I think I "almost" managed to make this work!
I need to change some words into links automatically but to do this, I need the CensoredWords "plugin" to only censor the body texts and not the topics's subjects otherwise some subjects would look like:

[url=http://www.google.com]Google[/url] is great!

In addition to the things listed in the above posts, I also modified MessageIndex.php as follows.
I edited this section:
// Censor the subject and message preview.
censorText($row['first_subject']);
censorText($row['first_body']);

// Don't censor them twice!
if ($row['id_first_msg'] == $row['id_last_msg'])
{
$row['last_subject'] = $row['first_subject'];
$row['last_body'] = $row['first_body'];
}
else
{
censorText($row['last_subject']);
censorText($row['last_body']);
}
}
else
{
$row['first_body'] = '';
$row['last_body'] = '';
censorText($row['first_subject']);

if ($row['id_first_msg'] == $row['id_last_msg'])
$row['last_subject'] = $row['first_subject'];
else
censorText($row['last_subject']);
}


as follows:
// Censor the subject and message preview.
//censorText($row['first_subject']);
//censorText($row['first_body']);

// Don't censor them twice!
if ($row['id_first_msg'] == $row['id_last_msg'])
{
//$row['last_subject'] = $row['first_subject'];
$row['last_body'] = $row['first_body'];
}
else
{
//censorText($row['last_subject']);
censorText($row['last_body']);
}
}
else
{
$row['first_body'] = '';
$row['last_body'] = '';
//censorText($row['first_subject']);

if ($row['id_first_msg'] == $row['id_last_msg'])
$row['last_subject'] = $row['first_subject'];
//else
// censorText($row['last_subject']);
}


This kind of works (only the body of the message gets censored, therefore the topics subjects stay uncensored), but problems arise when one edits a censored message (the body gets censored twice, making the automatically created links like this:

[url=http://www.[url=http://www.google.com]Google[/url].com][url=http://www.google.com]Google[/url][/url]

I temporarily fixed this by adding these "Censored Words":

Censor this:
[url=http://www.[url=http://www.google.com]Google[/url].com][url=http://www.google.com]Google[/url][/url]

Into this:
[url=http://www.google.com]Google[/url]

Which actually works because bodies can't be edited more than once at a time, basically.... but this solution does not look very kosher IMHO :)
Any suggestions?
Thanks

becometa

Quote from: Sciamano on January 03, 2013, 08:10:16 AM
(...)

This kind of works (only the body of the message gets censored, therefore the topics subjects stay uncensored), but problems arise when one edits a censored message (the body gets censored twice, making the automatically created links like this:

[url=http://www.[url=http://www.google.com]Google[/url].com][url=http://www.google.com]Google[/url][/url]

I temporarily fixed this by adding these "Censored Words":

Censor this:
[url=http://www.[url=http://www.google.com]Google[/url].com][url=http://www.google.com]Google[/url][/url]

Into this:
[url=http://www.google.com]Google[/url]

Which actually works because bodies can't be edited more than once at a time, basically.... but this solution does not look very kosher IMHO :)
Any suggestions?
Thanks


It's going to be a 5 years bump, but the problem is still there.
I've lurked the whole forum and search engines and came to the same conclusion as quoted member.

Is there anyone willing to share a way to stop censoring words covered by BBCode tags?

While mentioned method is working it certainly has a great impact on performance..

Arantor

QuoteIs there anyone willing to share a way to stop censoring words covered by BBCode tags?

There basically isn't one.

becometa

Quote from: Arantor on January 13, 2018, 05:14:48 PM
QuoteIs there anyone willing to share a way to stop censoring words covered by BBCode tags?

There basically isn't one.

Darn. Sad but true ;)

as a last resort, the solution suggested by Sciamano will be the one that will be used.

Advertisement: