| 1 | <?php |
|---|
| 2 | /** |
|---|
| 3 | * @package Comment RSS Security |
|---|
| 4 | * @author Palotas, Boldizsar |
|---|
| 5 | * @version 0.1 |
|---|
| 6 | */ |
|---|
| 7 | /* |
|---|
| 8 | Plugin Name: Comment RSS Security |
|---|
| 9 | Plugin URI: http://boldizsar.palotas.eu/blog/ |
|---|
| 10 | Description: Plugin that enhances the default security behaviour of WordPress. Disables showing comments related to private posts in RSS. |
|---|
| 11 | Author: Palotas, Boldizsar |
|---|
| 12 | Version: 0.1 |
|---|
| 13 | Author URI: http://boldizsar.palotas.eu/blog/ |
|---|
| 14 | */ |
|---|
| 15 | |
|---|
| 16 | function palotasb_comment_security($content) { |
|---|
| 17 | global $comment; |
|---|
| 18 | |
|---|
| 19 | $post = get_post($comment->comment_post_ID); |
|---|
| 20 | |
|---|
| 21 | if ( |
|---|
| 22 | isset($post->post_status) && |
|---|
| 23 | 'private' == $post->post_status |
|---|
| 24 | && !( |
|---|
| 25 | function_exists('current_user_can') && |
|---|
| 26 | (current_user_can('read_private_posts') || current_user_can('read_private_pages')) |
|---|
| 27 | ) |
|---|
| 28 | ) |
|---|
| 29 | $content = apply_filters("palotasb_comment_security_private", "<em>" . __("Enter your password to view comments") . "</em>"); |
|---|
| 30 | |
|---|
| 31 | return $content; |
|---|
| 32 | } |
|---|
| 33 | |
|---|
| 34 | add_filter("get_comment_text", "palotasb_comment_security"); |
|---|
| 35 | |
|---|
| 36 | ?> |
|---|