| 1 |
Content Blocker:
|
| 2 |
*****************
|
| 3 |
|
| 4 |
This module enables users to block the content they see according to various
|
| 5 |
parameters. Current implementations are for blocking by user and blocking
|
| 6 |
by leech feed.
|
| 7 |
|
| 8 |
Logged in users with appropriate permissions see links below selected
|
| 9 |
content, e.g., 'Block content by userx'. Clicking this link triggers
|
| 10 |
an AJAX update (or loads a form, if Javascript isn't available). On
|
| 11 |
subsequent page loads, any content by the blocked user will be filtered out
|
| 12 |
of node lists, views, etc.
|
| 13 |
|
| 14 |
Depends on Fast Toggle module.
|
| 15 |
|
| 16 |
Developer usage:
|
| 17 |
|
| 18 |
Content Blocker is fully modularized so as to be easily extended. New types
|
| 19 |
of blocking options can be added by writing an include file and adding it
|
| 20 |
to the module's /modules directory. The .inc file will be automatically
|
| 21 |
detected and offered as a choice for blocking if the module it implements
|
| 22 |
is available on the site.
|
| 23 |
|
| 24 |
Blocking comments
|
| 25 |
|
| 26 |
To have comments as well as nodes blocked for a given user, include the
|
| 27 |
following function in your theme's template.php file (if it's a PHPTemplate
|
| 28 |
theme; otherwise, adapt it for your theme):
|
| 29 |
|
| 30 |
<?php
|
| 31 |
function phptemplate_comment_view($comment, $links = array(), $visible = 1) {
|
| 32 |
global $user;
|
| 33 |
|
| 34 |
// Render the comment only if the comment's author isn't blocked by the current user.
|
| 35 |
if (!$user->uid || ($user->uid && !db_num_rows(db_query("SELECT id FROM {contentblocker} WHERE uid = %d AND id = %d AND type = 'user'", $user->uid, $comment->uid)))) {
|
| 36 |
return theme_comment_view($comment, $links, $visible);
|
| 37 |
}
|
| 38 |
return '';
|
| 39 |
}
|
| 40 |
?>
|