Skip to:
Content

Opened 9 years ago

Closed 7 weeks ago

Last modified 4 weeks ago

#459 closed task (fixed)

Consider making moderation forum specific

Reported by: mdawaffe Owned by:
Milestone: 2.6 Priority: high
Severity: normal Version:
Component: API - Moderation Keywords:
Cc: vpundir@…, jmdodd@…, stephen@…, jared@…, mercijavier@…, hamzahali@…, pericam@…, jjjay@…

Attachments (10)

459.1.diff (8.0 KB) - added by jmdodd 3 years ago.
Proof-of-concept: forum-mod taxonomy with AJAX-suggested user nicenames.
459.2.diff (8.1 KB) - added by johnjamesjacoby 3 years ago.
Uses get_users() instead of direct query
459.3.diff (14.8 KB) - added by jmdodd 3 years ago.
Helper functions.
leap-bbpress-permissions.zip (19.6 KB) - added by smithwib 18 months ago.
Proposed user and group permissions plugin
459.4.diff (15.3 KB) - added by netweb 18 months ago.
459.diff (18.5 KB) - added by johnjamesjacoby 17 months ago.
Cleaned up and mostly working. Needs testing.
459.5.diff (19.1 KB) - added by netweb 12 months ago.
459.6.diff (23.9 KB) - added by netweb 8 weeks ago.
459.7.diff (24.0 KB) - added by netweb 7 weeks ago.
Minor tweaks…
459.8.diff (24.7 KB) - added by tharsheblows 4 weeks ago.
needs refactoring to not be so redundant

Download all attachments as: .zip

Change History (80)

comment:1 @Trent9 years ago

  • Resolution set to fixed
  • Status changed from new to closed

This could be considered closed as so10 has created a plugin for this as well.

http://bbpress.org/forums/topic/403?replies=4

Trent

comment:2 @so1o9 years ago

I think it still needs to be a core forum functionality.

comment:3 @mdawaffe9 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Then let's reopen.

The first step is to make sure we use the right caps everywhere and to make sure they're robust enough.

comment:4 @mdawaffe9 years ago

(In [728]) Clean up edit_deleted cap. It should only be used in meta caps. re #459

comment:6 @sambauers6 years ago

  • Milestone changed from 1.0 to 1.5

Leaving this one in the "maybe later" pile for now.

comment:7 @kevinjohngallagher6 years ago

  • Priority changed from normal to high

comment:8 @johnjamesjacoby4 years ago

  • Milestone changed from Future Release to 2.1
  • Version 0.7.2 deleted

Still valid today and often requested even for bbPress 2.0. Moving to 2.1 to research in next release.

comment:9 @johnjamesjacoby4 years ago

  • Milestone changed from 2.1 to Future Release

Moving to future release. Should be done in 2.2.

comment:10 @johnjamesjacoby3 years ago

  • Milestone changed from Future Release to 2.2

comment:11 @jaredatch3 years ago

Looking forward to this in 2.2 - definitely a very common request and well be a very welcomed feature.

comment:12 @JarretC3 years ago

  • Cc JarretC added

comment:13 follow-up: @JarretC3 years ago

Anybody with any ideas on the best setup for this? The old plugin linked from the original thread posted in the ticket description had the forum moderators setup under the Users menu.

Would this still be an acceptable place for the menu to be or should it be placed somewhere else?

Also, what would be the best place to store the access info? I'm guessing usermeta table with its own row? Would like to work on this to expand my skills but don't want to get too far into it only to have it shot down and require major changes and essentially waste time.

comment:14 in reply to: ↑ 13 @johnjamesjacoby3 years ago

Replying to JarretC:

Anybody with any ideas on the best setup for this? The old plugin linked from the original thread posted in the ticket description had the forum moderators setup under the Users menu.

Also, what would be the best place to store the access info? I'm guessing usermeta table with its own row? Would like to work on this to expand my skills but don't want to get too far into it only to have it shot down and require major changes and essentially waste time.

For a first pass, store an array of user_id's in each forum's postmeta. We can map the 'moderate' cap to the user as we need to after the fact.

This setting will really only be relevant on the forum page. I can see needing to query it from either direction, but we're stuck either way and building a UI inside the profile area to assign which forums to what users is beyond the scope of this ticket.

comment:15 follow-up: @etivite3 years ago

also keep in mind the future bbpress->buddypress group forums and that bbpress may need to know about bp_group_admin_mods_...

maybe mimic the same functions/setup from buddypress but using roles/cap instead of db flags

comment:16 @sooskriszta3 years ago

  • Cc vpundir@… added

comment:17 in reply to: ↑ 15 @johnjamesjacoby3 years ago

  • Component changed from Administration to Moderation
  • Milestone changed from 2.2 to Future Release

Replying to etivite:

also keep in mind the future bbpress->buddypress group forums and that bbpress may need to know about bp_group_admin_mods_...

maybe mimic the same functions/setup from buddypress but using roles/cap instead of db flags

Exactly. We'd map the 'moderate' cap to a user based on what forum they are viewing. Agree we'd want to play nicely with BuddyPress group moderators too.

That said, running out of time in 2.2 to do this, so moving to future release.

comment:18 @johnjamesjacoby3 years ago

  • Milestone changed from Future Release to 2.3

Moving to 2.3.

comment:19 @jmdodd3 years ago

  • Cc jmdodd@… added

comment:20 @netweb3 years ago

  • Cc stephen@… added

@jmdodd3 years ago

Proof-of-concept: forum-mod taxonomy with AJAX-suggested user nicenames.

comment:21 @johnjamesjacoby3 years ago

I like this. The metabox idea is familiar, and an easy win. I think I'm okay with being able to add usernames that don't exist too. Suggesting names says "hey we found these matches" and letting the user add what they want says "hey, that's cool... whatevs."

@johnjamesjacoby3 years ago

Uses get_users() instead of direct query

comment:22 follow-up: @jmdodd3 years ago

In the interest of possibly extending taxonomies to include participate and spectate for better ACL support, changed forum moderator taxonomy from 'forum-mod' to 'bbp-moderate'; helper functions in progress but I need to test them more thoroughly before dealing with assigning/modifying capabilities based on forum.

@jmdodd3 years ago

Helper functions.

comment:23 in reply to: ↑ 22 @johnjamesjacoby3 years ago

Replying to jmdodd:

In the interest of possibly extending taxonomies to include participate and spectate for better ACL support, changed forum moderator taxonomy from 'forum-mod' to 'bbp-moderate'; helper functions in progress but I need to test them more thoroughly before dealing with assigning/modifying capabilities based on forum.

This makes sense to me. Also opens the door back up for Bozo support, too.

comment:24 follow-up: @jmdodd3 years ago

Helper functions in 459.3.diff have been tested and are working fine with test users and assigning them to moderate forums. Getting back expected results re: forum moderators and moderator's forums.

Rough numbers for the current codebase (r4532):

~200 instances of 'current_user_can', including the following functions that look like they could be consolidated:

  • bbp_current_user_can_publish_forums(), bbp_current_user_can_access_create_forum_form(),
  • bbp_current_user_can_publish_topics(), bbp_current_user_can_access_create_topic_form(),
  • bbp_current_user_can_publish_replies(), bbp_current_user_can_access_create_reply_form().

12 instances of 'bbp_user_can_view_forum'.

20 instances of 'user_can'.

Possibilities:

  • Rolling our own bbp_user_can() (bbp_current_user_can()?) and trying to figure out what we're asking permission for via globals. I'd rather not get too far divorced from WordPress on capability handling so this is not really my favorite solution.
  • A thorough audit to make sure that the relevant forum/topic/reply ids are being passed to current_user_can(), and that the right caps are being checked.
  • Filtering on user_has_cap might also work, but I think passing explicit forum/topic/reply ids is preferable to relying on global values.

comment:25 @johnjamesjacoby3 years ago

  • Milestone changed from 2.3 to 2.4

Looking like a bit of a rabbit hole, so let's move this off to 2.4. This gives us time to iterate on these other architectural issues until then.

comment:26 @jaredatch2 years ago

  • Cc jared@… added

comment:27 @mercime2 years ago

  • Cc mercijavier@… added

comment:28 @johnjamesjacoby2 years ago

  • Milestone changed from 2.4 to 2.5

No movement in a while. No time for 2.4. Moving to 2.5.

comment:29 @johnjamesjacoby2 years ago

  • Milestone changed from 2.5 to 2.6

2.5 is going to focus on performance improvements. Moving to 2.6.

comment:30 @johnjamesjacoby22 months ago

  • Milestone changed from 2.6 to 2.7

Bump to 2.7.

@smithwib18 months ago

Proposed user and group permissions plugin

comment:32 follow-up: @smithwib18 months ago

Per John James Jacoby's suggestion, I've uploaded the draft version of a plugin I wrote. It optionally works with the User Groups plugin by Katz Web Services if installed. It needs some TLC by experts in actions + filters, I18N, etc.

@netweb18 months ago

comment:33 @netweb18 months ago

In 459.4.diff:

Refresh of 459.3.diff to apply cleanly against /trunk

comment:34 in reply to: ↑ 32 @netweb18 months ago

Replying to smithwib:

Per John James Jacoby's suggestion, I've uploaded the draft version of a plugin I wrote. It optionally works with the User Groups plugin by Katz Web Services if installed. It needs some TLC by experts in actions + filters, I18N, etc.

@smithwib Thanks for the upload, will take a look at your plugin soon.

comment:35 follow-up: @johnjamesjacoby18 months ago

Really liking the progress on patches here. There are a few things I'd like to tweak, but overall think this is the way to go. With a patch attached, I'm wondering if we can move this to 2.6, and move bbPress comments to 2.7.

comment:36 in reply to: ↑ 35 @netweb18 months ago

Replying to johnjamesjacoby:

I'm wondering if we can move this to 2.6, and move bbPress comments to 2.7.

Either/or, I've been looking at this with the goal of 'bozo' functionality as bbPress v2.x starts appearing (and/or thinking of appearing) on more wordpress.org sites.

Also of note is 'bbPress Per Forum Moderation' is part of @dragooon's (Shitiz Garg) GSoC proposal.

@johnjamesjacoby17 months ago

Cleaned up and mostly working. Needs testing.

comment:37 @johnjamesjacoby17 months ago

  • Keywords needs-testing added
  • Milestone changed from 2.7 to 2.6
  • Type changed from enhancement to task

comment:38 @johnjamesjacoby17 months ago

The only problem I see with this patch is get_objects_in_term() is not cached, meaning we'll need to add our own setting/busting for this on CRUD actions.

comment:39 @johnjamesjacoby17 months ago

wp_get_object_terms() usage needs to be checked to make sure caching is sufficient also.

comment:40 @JarretC17 months ago

  • Cc JarretC removed

comment:41 @netweb17 months ago

Do we want to list the forums moderators anywhere?

Below screenshot/hack in the forum template notice and/or after the forum description.

https://i.cloudup.com/l6rfiE5s3Z.png

Looking at that above if it was to be in the template notice something more along the lines of:

This forum is moderated by User123, contains 2 topics and 3 replies, and was last updated by admin 2 weeks ago.

I think I may have just answered my own question as to a decision or option, if a forum as 10 moderators this will get ugly quite quickly...

comment:42 follow-up: @netweb17 months ago

Testing 459.diff 'Forum Moderator' vs 'Moderator' capability checks:

  • 'Moderator' can 'edit others topics' - 'Forum Moderators' cannot
  • 'Moderator' can 'edit topic tags' - 'Forum Moderators' cannot
  • 'Moderator' and 'Forum Moderators' can merge, split, close, stick and spam topics/replies

comment:43 in reply to: ↑ 42 ; follow-up: @johnjamesjacoby17 months ago

Replying to netweb:

Testing 459.diff 'Forum Moderator' vs 'Moderator' capability checks:

  • 'Moderator' can 'edit others topics' - 'Forum Moderators' cannot
  • 'Moderator' can 'edit topic tags' - 'Forum Moderators' cannot
  • 'Moderator' and 'Forum Moderators' can merge, split, close, stick and spam topics/replies

This seems fine to me, and the desired result IMO.

comment:44 in reply to: ↑ 43 @netweb17 months ago

Replying to johnjamesjacoby:

This seems fine to me, and the desired result IMO.

Cool

comment:45 @netweb17 months ago

Whilst digging around with topic and reply moderation I found a few issues with topics and replies whose post status is pending.

You cannot view any topics or replies with status pending on the front end, forum moderator, moderator or keymaster included. This includes using the view=all query string.

To view topics and replies and approve them you must be a keymaster and approve them from the backend.

comment:46 @hamzahali17 months ago

  • Cc hamzahali@… added

I did testing for this one, seems working fine, only the add moderator option in forums menu (admin area) seems to be of no use, Till when can we expect this to be included in the core.

comment:47 @netweb17 months ago

hamzahali,

When you are editing a forum when you start typing a name it will populate a dropdown with a list of usernames. At this stage this is expected to be included with the next version of bbPress, though that is not 100% decided just yet.

https://i.cloudup.com/UMvAHIbFIH.png

comment:48 @hamzahali16 months ago

I have done lots of testing of this one, and it seems 100% fine

comment:49 follow-up: @dreamwork13 months ago

The last file, includes/users/functions.php
I couldn't find anywhere to place the code!! Then I just have it placed on the bottom, and I fail!

What version you guys test it for?

comment:50 in reply to: ↑ 49 @netweb13 months ago

Replying to dreamwork:

The last file, includes/users/functions.php
I couldn't find anywhere to place the code!! Then I just have it placed on the bottom, and I fail!

What version you guys test it for?

You need to apply the patch against the bbPress development source code, see the WordPress handbook on working with patches here (and related references in the handbook). If you have any other questions please post on the support forums https://bbpress.org and I'll answer them there as discussing them here in this ticket is not the place for these discussions.

comment:51 @netweb12 months ago

In 459.5.diff a refresh of 459.diff to apply cleanly against /trunk

@netweb12 months ago

comment:52 @sambauers12 months ago

I hope this ticket never closes. I use the email notifications to remind me which decade I'm in.

comment:53 @johnjamesjacoby12 months ago

  • Milestone changed from 2.6 to 3.0

Moved to 3.0, due September 15, 2020. :)

Last edited 12 months ago by johnjamesjacoby (previous) (diff)

comment:55 @slackbot10 months ago

This ticket was mentioned in Slack in #meta by jjj. View the logs.

comment:56 @netweb7 months ago

  • Milestone changed from 3.0 to 2.6

Let's get this into 2.6 and stop being a cheat sheet for @sambauers ;)

p.s. New Year, Same Decade

comment:57 @Stagger Lee2 months ago

  • Cc pericam@… added

comment:58 @slackbot2 months ago

This ticket was mentioned in Slack in #meta-i18n by netweb. View the logs.

@netweb8 weeks ago

comment:59 in reply to: ↑ 24 @netweb8 weeks ago

Have refreshed the existing patches in 459.6.diff: with updated docs, formatting a few minor fixes.
I'm currently writing a bunch of unit tests outlined in comment:24
Still yet to look at get_objects_in_term() and caching mentioned in comment:38
Also needing to look at wp_get_object_terms() caching mentioned in in comment:39:
Merging this should be good to go, merging sooner rather than later so another refresh isn't needed, iterate further once committed.

comment:60 @sambauers8 weeks ago

Hi Stephen!

http://www.vh1.com/news/wp-content/uploads/2015/07/th-2-1436452593.gif

@netweb7 weeks ago

Minor tweaks...

comment:61 @johnjamesjacoby7 weeks ago

In 5834:

Moderators: First pass at per-forum moderators.

This commit introduces a powerful feature commonly found in other popular forum software that has been on our wishlist for nearly 9 years. It includes the following changes:

  • Custom forum-mod taxonomy for assigning user nicenames to forum IDs
  • Associated functions for defining capabilities, labels, etc...
  • New capability filters for ensuring forum moderators have the ability to moderate forums even without the moderator role assignment
  • New option for toggling the entire feature on/off (on by default)

Props jmdodd, netweb. See #459.

comment:62 @johnjamesjacoby7 weeks ago

In 5835:

Moderators: Introduce none argument for topic-tags & forum-mods list functions.

This change allows for passing text or HTML to output if no taxonomy terms are found, and uses this new functionality in wp-admin to show per-forum moderators in the list-table column, also reducing code duplication.

See #459.

comment:63 @johnjamesjacoby7 weeks ago

In 5836:

Moderators: Add forum moderators field to form-forum.php template part. See #459.

comment:64 @johnjamesjacoby7 weeks ago

In 5837:

Terms: Update functions for getting terms & term names to be more flexible & reusable by other functions. See #459.

comment:65 @johnjamesjacoby7 weeks ago

In 5838:

Moderators: Introduce functions for theme-side setting & getting of forum mods for form-forum.php. See #459.

comment:66 @johnjamesjacoby7 weeks ago

In 5839:

Moderators: Rename bbp_get_forum_mod_ids() to bbp_get_forum_moderator_ids() to better match unabbreviated forum equivalent. Also update phpdoc & refactor some logic to use cached functions. See #459.

comment:67 @johnjamesjacoby7 weeks ago

In 5841:

Moderation: Fix some copy-pasta and make sure form terms are formatted correctly. See #459.

comment:68 @johnjamesjacoby7 weeks ago

  • Keywords needs-testing removed
  • Resolution set to fixed
  • Status changed from reopened to closed

Let's call this "fixed" and open new tickets for new issues & enhancements, likely in 2.7.

Sam, you may want to find a new ticket to subscribe to. <3

comment:69 @slackbot7 weeks ago

This ticket was mentioned in Slack in #bbpress by netweb. View the logs.

comment:70 @slackbot7 weeks ago

This ticket was mentioned in Slack in #bbpress by netweb. View the logs.

comment:71 @tharsheblows4 weeks ago

  • Cc jjjay@… added

Sorry, I'm not quite sure if I should add this here or open a new one or what. Anyway, here's a slightly different way of doing it with some more admin bits.

@tharsheblows4 weeks ago

needs refactoring to not be so redundant

Note: See TracTickets for help on using tickets.