Skip to:
Content

BuddyPress.org

Opened 6 years ago

Closed 5 years ago

Last modified 5 years ago

#5113 closed enhancement (fixed)

Non multisite blogs need Account settings component to be active to mark a user as spammer

Reported by: imath Owned by: boonebgorges
Milestone: 2.0 Priority: normal
Severity: normal Version: 1.7
Component: Administration Keywords: has-patch
Cc: mercijavier@…

Description

Hi,

This is a suggestion to help you think about the fact that if the component Account Settings is not active on a regular blog (non multisite), then the admin has no way to mark a user as spammer.

As this component is not set to active on a fresh install, i think it can be problematic for this kind of blogs.

There's a possibility to make this component active by default, but i think as it can be deactivated by admin, i explored another way.

I may have made things wrong about this, so i apologize if i did.

You'll find a diff that creates a new row actions on the wp-admin/users.php screen to mark or unmark a user as spammer and handles this action.

Attachments (4)

5113.diff (4.5 KB) - added by imath 6 years ago.
5113.02.patch (6.1 KB) - added by boonebgorges 6 years ago.
5113.03.patch (5.8 KB) - added by r-a-y 5 years ago.
bulk_trick.diff (1.1 KB) - added by imath 5 years ago.

Download all attachments as: .zip

Change History (17)

@imath
6 years ago

#1 follow-up: @r-a-y
6 years ago

  • Component changed from Members to Administration
  • Keywords has-patch needs-testing added
  • Milestone changed from Awaiting Review to 1.9
  • Version changed from 1.8 to 1.7

I totally agree with this one, imath. Thanks for the patch!

Moving to 1.9.

#2 in reply to: ↑ 1 @imath
6 years ago

Replying to r-a-y:

I totally agree with this one, imath. Thanks for the patch!

Thanks r-a-y, you're welcome :)

#3 @boonebgorges
6 years ago

  • Keywords needs-refresh added; needs-testing removed
  • Milestone changed from 1.9 to 2.0

I spent a bit of time working with this patch, and while I think it's good, I am a bit uneasy about it. I don't want to create a disparity between the interface in MS and non-MS. I should say, there is of course *already* a disparity that this ticket is trying to resolve, and I don't want to create another one.

Since the root issue here is that WordPress Multisite has a native interface for spamming users, and BuddyPress introduces the concept of spam users into non-Multisite, I think BP's goal should be to provide the same user experience in non-Multisite as what's available in MS. At a minimum, I think this means that we should be adding bulk actions "Mark as Spam" and "Not Spam" on wp-admin/users.php. And if we're going to add the row-actions links (which I really, really like), we should do it in MS too.

5113.02.diff does some of this work. It cleans up the patch a little, and adds the row-actions in MS. However, it looks like some of the new functionality has the effect of breaking nonce checks when performing the native bulk actions in MS, so more work is needed to figure this out. And I haven't looked at adding bulk actions to non-MS, though this shouldn't be too hard.

Moving to 2.0.

#4 @mercime
6 years ago

  • Cc mercijavier@… added

@r-a-y
5 years ago

#5 @r-a-y
5 years ago

  • Keywords needs-refresh removed

03.patch fixes Boone's issue with using multisite's bulk spam action.

It does a check for the $_POST['mode'] parameter and bails if a bulk action is in use.

#6 @boonebgorges
5 years ago

Thanks a million, r-a-y.

I started to add bulk actions, but it turns out that, WP only allows you to *remove* bulk actions, not add them. See https://core.trac.wordpress.org/browser/trunk/src/wp-admin/includes/class-wp-list-table.php?annotate=blame#L284 and https://core.trac.wordpress.org/ticket/16031. This is not worth extending WP_List_Table for.

Let's go with the patch as it currently stands. It doesn't introduce 100% parity between MS and non-MS, but it's pretty close.

#7 @boonebgorges
5 years ago

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

In 8174:

Enable Spam admin tools on non-MS users.php Dashboard panel

This change brings non-MS installations of BuddyPress closer to the
functionality that is native to WP Multisite, with respect to the ability to
manage spam/ham users from the Users panel. It also addresses a shortcoming
whereby admins on non-MS sites would have no way at all to spam/unspam users
if the Settings component was disabled, since the front-end Spam tools are in
that optional component.

Fixes #5113

Props imath, r-a-y

#8 follow-up: @r-a-y
5 years ago

I started to add bulk actions, but it turns out that, WP only allows you to *remove* bulk actions, not add them.

Read some posts linked from that ticket suggesting adding bulk actions via javascript as a workaround, but that seems a little hacky.

If we really wanted to achieve parity, we could do that.

#9 @boonebgorges
5 years ago

If we really wanted to achieve parity, we could do that.

Ugh.

:)

#10 in reply to: ↑ 8 @imath
5 years ago

Replying to r-a-y:

If we really wanted to achieve parity, we could do that.

Or use another trick in PHP.. see the patch bulk_trick.diff

@imath
5 years ago

#11 @r-a-y
5 years ago

Or use another trick in PHP.. see the patch bulk_trick.diff

Nice! That's a neat trick indeed! ;)

We'll also have to reimplement the bulk-action handling when spamming / unspamming a user for single-site.

#12 follow-up: @boonebgorges
5 years ago

Errr. This is a neat trick, but could cause namespace problems and who knows what else. I'd much rather that we push WP toward fixing the underlying issue. Maybe this can be moved to a separate ticket.

#13 in reply to: ↑ 12 @imath
5 years ago

Replying to boonebgorges:

Errr. This is a neat trick, but could cause namespace problems and who knows what else. I'd much rather that we push WP toward fixing the underlying issue. Maybe this can be moved to a separate ticket.

I agree, anyway there's something wrong when trying to get the action, i thought it was javascript, but it looks like it's a redirect.. so the action is not available once posted unless the bottom bulk has been used

Note: See TracTickets for help on using tickets.