# How to filter comments before they are published

**URL:** <https://www.ruby-forum.com/t/how-to-filter-comments-before-they-are-published/197931>\
**Category:** Radiant CMS\
**Created:** [October 22, 2010, 9:47pm UTC](https://www.ruby-forum.com/t/how-to-filter-comments-before-they-are-published/197931 "2010-10-22T21:47:04Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![okkezSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/85f322/32.png) [@okkezSS](https://www.ruby-forum.com/u/okkezSS)\
**Post date:** [October 22, 2010, 9:47pm UTC](https://www.ruby-forum.com/t/how-to-filter-comments-before-they-are-published/197931/1 "2010-10-22T21:47:04Z")

</div>

I’m getting loads of comments…you can imagine the descriptions!! I  
can’t  
keep up with deleting them. How do I create a filter so that I must  
approve comments before they can appear on my site?

Thank you so much.

---

<div class="post-metadata">

**Author:** ![diann\_s](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cc9497/32.png) [@diann\_s](https://www.ruby-forum.com/u/diann_s)\
**Post date:** [October 22, 2010, 10:56pm UTC](https://www.ruby-forum.com/t/how-to-filter-comments-before-they-are-published/197931/2 "2010-10-22T22:56:19Z")

</div>

I just added docs for this, but set

Radiant::Config[‘comments.auto\_approve’] = false

and you’ll need to approve each one. I’d like to make the standard  
spam-blocking a bit more robust in the future.

---

<div class="post-metadata">

**Author:** ![diann\_s](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cc9497/32.png) [@diann\_s](https://www.ruby-forum.com/u/diann_s)\
**Post date:** [October 22, 2010, 11:18pm UTC](https://www.ruby-forum.com/t/how-to-filter-comments-before-they-are-published/197931/3 "2010-10-22T23:18:07Z")

</div>

Jim G. wrote in post #956414:

> I just added docs for this, but set
> 
> Radiant::Config[‘comments.auto\_approve’] = false
> 
> and you’ll need to approve each one. I’d like to make the standard  
> spam-blocking a bit more robust in the future.

=====  
Thank you Jim.  
Where do I put this code?

---

<div class="post-metadata">

**Author:** ![diann\_s](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cc9497/32.png) [@diann\_s](https://www.ruby-forum.com/u/diann_s)\
**Post date:** [October 23, 2010, 2:03pm UTC](https://www.ruby-forum.com/t/how-to-filter-comments-before-they-are-published/197931/4 "2010-10-23T14:03:21Z")

</div>

Diann S. wrote in post #956424:

> Jim G. wrote in post #956414:
> 
> > I just added docs for this, but set
> > 
> > Radiant::Config[‘comments.auto\_approve’] = false
> > 
> > and you’ll need to approve each one. I’d like to make the standard  
> > spam-blocking a bit more robust in the future.
> 
> =====  
> Thank you Jim.  
> Where do I put this code?

Tried putting it on the “Settings” page..but…tsk.

---

<div class="post-metadata">

**Author:** ![diann\_s](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cc9497/32.png) [@diann\_s](https://www.ruby-forum.com/u/diann_s)\
**Post date:** [October 23, 2010, 3:08pm UTC](https://www.ruby-forum.com/t/how-to-filter-comments-before-they-are-published/197931/5 "2010-10-23T15:08:41Z")

</div>

On Sat, Oct 23, 2010 at 8:03 AM, Diann S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > Thank you Jim.  
> > Where do I put this code?
> 
> Tried putting it on the “Settings” page..but…tsk.
> 
> –

Sorry, Diane. I don’t mean to be cryptic.

If you have the Setting extension installed, you can create a new  
setting for “comments.auto\_approve” but it sounds like you don’t have  
that.

You’ll need to put this in your config/environment.rb and redeploy the  
application.  
Take a look at

> **[Customizing the Admin UI](https://github.com/radiant/radiant/wiki/customizing-the-admin-ui)**
>
> Radiant is a no-fluff, open source content management system designed for small teams. - radiant/radiant

---

<div class="post-metadata">

**Author:** ![diann\_s](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cc9497/32.png) [@diann\_s](https://www.ruby-forum.com/u/diann_s)\
**Post date:** [October 23, 2010, 6:19pm UTC](https://www.ruby-forum.com/t/how-to-filter-comments-before-they-are-published/197931/6 "2010-10-23T18:19:34Z")

</div>

Hi,

after long investigation, I now have found the solution to get running  
the paperclipped extension on my Windows developer machine. For those of  
You, who are in the same situation (developing under Windows, deploying  
to \*ix) this may be helpful. I had to fix all 3 errors to get it  
working.

All errors have the same impact: Paperclipped can’t find ImageMagick  
(even if it is installed in Your PATH) and brings up error messages in  
log while uploading images like:

[paperclip] identify ‘-format’ ‘%wx%h’  
‘C:/DOCUME~1/horibo/LOCALS~1/Temp/stream,3296,0.jpg[0]’ 2\>NUL  
[paperclip] An error was received while processing:  
#\<Paperclip::NotIdentifiedByImageMagickError:  
C:/DOCUME~1/horibo/LOCALS~1/Temp/stream,3296,0.jpg is not recognized by  
the ‘identify’ command.\>

1. Install ImageMagick in a path without spaces  
For some reason, paperclip won’t find it, if the path to ImageMagick  
contains spaces (e.g. “C:\Program Files\ImageMagick”). Don’t forget to  
update Your PATH.

2. Give paperclip the path to ImageMagick  
Even if in Your PATH, paperclip won’t find ImageMagick. I put the  
following code in my /config/environments/development.rb:  
Paperclip.options[:command\_path] = “C:/Programs/ImageMagick-6.4.6-Q16/”

3. Avoid calling ImageMagick with single quotes  
This is a long known issue with the paperclip plugin, which still isn’t  
fixed in the master tree. The bug fix still works on \*ix systems.

Apply the following patch to  
/vendor/extensions/paperclipped/vendor/plugins/paperclip/lib/paperclip.rb  
at  
line 133:

- option.split("’").map{|m| “’#{m}’” }.join("\’")

- option.split("’").map{|m| “”#{m}""}.join("\’")

Enjoy!

Horst

---

<div class="post-metadata">

**Author:** ![diann\_s](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cc9497/32.png) [@diann\_s](https://www.ruby-forum.com/u/diann_s)\
**Post date:** [October 23, 2010, 9:23pm UTC](https://www.ruby-forum.com/t/how-to-filter-comments-before-they-are-published/197931/7 "2010-10-23T21:23:30Z")

</div>

Hi,

I want to use this code within a page several times with different  
orientations (image\_left/image\_right) and different ids:

#### 

I tried to be DRY by using the parameterized\_snippets extension and put  
this code into a snippet:

"\> " size="normal" /\>
#### " /\>

" /\>

and call it from the page like:

\<r:snippet name=“include\_image” id=“3” orientation=“left” /\>

But this doesn’t work. The ID and orientation is resolved correctly. But  
the r:assets tags are not resolved and appear as plain text in the page.

Is it possible to use the attached assets of a page within a snippet?

If not, is there any other way to avoid repeating the same code several  
times?

Best Regards  
Horst

---

<div class="post-metadata">

**Author:** ![diann\_s](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cc9497/32.png) [@diann\_s](https://www.ruby-forum.com/u/diann_s)\
**Post date:** [October 23, 2010, 9:46pm UTC](https://www.ruby-forum.com/t/how-to-filter-comments-before-they-are-published/197931/8 "2010-10-23T21:46:07Z")

</div>

From “Basic Usage” at [Radius Tags · radiant/radiant Wiki · GitHub](http://github.com/radiant/radiant/wiki/Radius-Tags)

"As the |\<r:parent\>| example above shows, it is possible to nest Radius  
tags _within_ other Radius tags, so long as they are separate elements.  
However, _using a Radius tag as the the attribute of another Radius tag  
is /NOT ALLOWED/_. For example:

|\<r:if\_url matches=“\<r:parent\>\<r:url/\>\</r:parent\>”\>…\</r:if\_url\>  
^ DON’T DO THIS, it breaks! ^|

Now you’re probably wondering, “How can I use variables or constants  
within the attributes of a Radius tag?” The answer is that you can’t."

What you could do is write a custom tag to output this entire set of  
HTML - see  
[Adding Custom Radius Tags · radiant/radiant Wiki · GitHub](http://github.com/radiant/radiant/wiki/Adding-Custom-Radius-Tags) for  
more details.

Wes

---

<div class="post-metadata">

**Author:** ![diann\_s](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cc9497/32.png) [@diann\_s](https://www.ruby-forum.com/u/diann_s)\
**Post date:** [October 24, 2010, 5:30am UTC](https://www.ruby-forum.com/t/how-to-filter-comments-before-they-are-published/197931/9 "2010-10-24T05:30:42Z")

</div>

Hold up! If you add the Backdoor extension you can use this:

\<r:ruby\>  
@parent\_url = ‘\<r:parent\>\<r:url/\>\</r:parent\>’  
“”  
\</r:ruby\>

\<r:if\_url matches="=@parent\_url " \>…\</r:if\_url\>

---

<div class="post-metadata">

**Author:** ![diann\_s](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cc9497/32.png) [@diann\_s](https://www.ruby-forum.com/u/diann_s)\
**Post date:** [October 25, 2010, 9:00pm UTC](https://www.ruby-forum.com/t/how-to-filter-comments-before-they-are-published/197931/10 "2010-10-25T21:00:15Z")

</div>

Sorry I don’t know but without = or # it doesn’t seem to work.

---

<div class="post-metadata">

**Author:** ![diann\_s](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cc9497/32.png) [@diann\_s](https://www.ruby-forum.com/u/diann_s)\
**Post date:** [October 26, 2010, 11:31pm UTC](https://www.ruby-forum.com/t/how-to-filter-comments-before-they-are-published/197931/11 "2010-10-26T23:31:22Z")

</div>

This goes against the design of Radius.

You might be able to write a new assets tag and parse the contents of  
the attributes first before rendering the tag. Or write an assets tag  
that checks to see if a local variable exists and use that if there is  
no id given.
