[wp-hackers] Comment Moderation UI limited for the Author
Jared Bangs
jaredbangs at gmail.com
Mon Apr 27 15:49:03 GMT 2009
Dan, oh yeah, that makes more sense now - you just want a filtered
view of the edit comments page that only includes comments for that
author.
If I may, I'll throw in a couple additional "requirements" that I'm
assuming you'll want:
1. You want the edit comments page to work normally for other users
(editors, admins, etc.) and only want the filtered view for authors.
2. Since this is (I'm assuming) for a client or someone other than
yourself, you wouldn't want to hinder their ability to do upgrades in
the future.
In light of #1, I think you at least want to wrap whatever you do in
code that only does it for the author users, since otherwise you could
lock out admins from doing moderation, etc.
In light of #2 (and depending how they will be doing upgrades), I
would recommend steering clear of hacking the core files, since an
upgrade would potentially break whatever you do.
As Jesse mentioned, the hooks aren't quite there for this to be done
easily in a plugin, although I'm guessing a patch to add a hook inside
of _wp_get_comment_list may be accepted since it seems like this type
of thing might be a common useful feature for plugins to be able to
do.
If you're interested in going the plugin route, I think there are
still a couple approaches you could explore, even though they are a
bit more work than what Jesse recommended:
A. Altering the final query sql itself with a query filter that
catches it under the right conditions
B. Pluging in a new admin comment management page that borrows as much
as possible from the original, but also adds your required filters,
and then telling them to use that. You could get fancy and try to hide
the original page and/or redirect them to this new one if you wanted
to make it easier or force them to use it.
- Jared
On Mon, Apr 27, 2009 at 6:38 AM, Silverstein, Jesse
<Jesse.Silverstein at xerox.com> wrote:
> Upon further research, there are no plugin hooks anywhere close to where
> you would need them for this alteration, so if you want to get it done
> now, here is the quick'n'dirty hack (based off 2.8 trunk, and not
> tested, only theoretical):
>
> In wp-admin/edit-comments.php, above the line that starts
> "list($_comments, $total) = _wp_get_comment_list(...", which should be
> 201 add the following line:
>
> $post_id = join(", ", $wpdb->get_col($wpdb->prepare("SELECT ID FROM
> {$wpdb->posts} WHERE post_author = %d", wp_get_current_user())));
>
> Then, in wp-admin/template.php, in the _wp_get_comment_list function:
> Comment out/delete line 1987: $post = (int) $post;
> Change line 2008 from:
> $post = " AND comment_post_ID = '$post'";
> To:
> $post = " AND comment_post_ID IN ($post)";
>
> Hope this helps. Happy hacking.
>
> -Jesse
>
> -----Original Message-----
> From: wp-hackers-bounces at lists.automattic.com
> [mailto:wp-hackers-bounces at lists.automattic.com] On Behalf Of
> Silverstein, Jesse
> Sent: Monday, April 27, 2009 8:19 AM
> To: wp-hackers at lists.automattic.com
> Subject: RE: [wp-hackers] Comment Moderation UI limited for the Author
>
> More clarification needed:
>
> Do you want non-authenticated users to be able to see the comments on
> each post? Do you want the different authors to be able to read the
> comments on each post, but just not be able to see them in the comments
> moderation admin page?
>
> If the answers are both yes, and the permissions are already correct
> (i.e. the authors already cannot moderate comments that do not belong to
> their posts), but the issue is just with visibility in the admin screen,
> it should be fairly easy to hack or plugin.
>
> -Jesse Silverstein
>
>
> -----Original Message-----
> From: wp-hackers-bounces at lists.automattic.com
> [mailto:wp-hackers-bounces at lists.automattic.com] On Behalf Of Daniel
> Cameron
> Sent: Monday, April 27, 2009 4:09 AM
> To: wp-hackers at lists.automattic.com
> Subject: [wp-hackers] Comment Moderation UI limited for the Author
>
> Jared:
> You're right, there's some major clarification needed. Especially since
> I
> formed the question around comment moderation instead of the comment
> moderation UI (which was the original intent of the submission, even
> though
> I confused the topic--and myself--when I brought in role capabilities).
>
> Here it goes again:
>
> Anyone have recommendations on how to limit the comment moderation [page
> for] the post author, [so they don't see comments across the entire
> site]?
>
> Basically, we will have a post that only the author could manage
> comments
> [default author level]. Authors with a single post attributed to them,
> should be able to edit the comments attributed to their posts but no-one
> else's (default "author" role) [nor should they be able to see other
> comments within their comment moderation page].
>
>
> We're running into the same issue with Media management but are handling
> that much differently.
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.0.238 / Virus Database: 270.12.4/2081 - Release Date:
> 04/26/09 09:44:00
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.0.238 / Virus Database: 270.12.4/2081 - Release Date:
> 04/26/09 09:44:00
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
More information about the wp-hackers
mailing list