Skip to:

Opened 7 years ago

Closed 6 years ago

#7478 closed enhancement (fixed)

Performance improvement for bp_is_user_spammer in member loops

Reported by: sbrajesh's profile sbrajesh Owned by: djpaul's profile djpaul
Milestone: 3.0 Priority: normal
Severity: normal Version:
Component: Members Keywords: has-patch commit
Cc: sbrajesh


bp_is_user_spammer() causes O(n) queries in member loop. This can be cut down to zero by adding another case in the switch/case block.

We already have the members info available for the looping member and even though it is not WP_User, It does have the properties needed in the function for checking status.

Please see the attached patch.

If you want to test the behaviour, Please try adding some information in members loop based on bp_is_user_spammer condition. yes, the spam users won't be listed in the members directory but there are cases, where we need this test in members loop.

It will be nice to have this enhancement.

Thank you

Attachments (1)

bp-is-user-spammer-performance.patch (635 bytes) - added by sbrajesh 7 years ago.

Download all attachments as: .zip

Change History (4)

#1 @DJPaul
6 years ago

  • Milestone changed from Awaiting Review to 3.0

I like it!

#2 @DJPaul
6 years ago

  • Keywords commit added

#3 @djpaul
6 years ago

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

In 11663:

Members: improve bp_is_user_spammer() performance when used in Member loops.

Fixes #7478

Props sbrajesh

Note: See TracTickets for help on using tickets.