[buddypress-trac] [BuddyPress Trac] #8853: Bug in filters for 2 entity (class-bp-invitation.php , class-bp-notifications-notification.php)

buddypress-trac noreply at wordpress.org
Tue Mar 14 08:51:00 UTC 2023


#8853: Bug in filters for 2 entity (class-bp-invitation.php , class-bp-
notifications-notification.php)
--------------------------+-----------------------------
 Reporter:  aleey1982     |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  high          |  Milestone:  Awaiting Review
Component:  Core          |    Version:
 Severity:  major         |   Keywords:  has-patch
--------------------------+-----------------------------
 Version: 2.2.9
 Site: http://kluchimasterstva.ru/treningi/

 I found a bug in
  - class-bp-invitation.php
  - class-bp-notifications-notification.php
 In public static function get( $args = array() ) created an filter for sql
 query:

 {{{
 $where_sql = self::get_where_sql
 ...
 'user_id'           => $r['user_id'],"
 ....
 }}}


 Look at "get_where_sql" function, in case if user is not login

 {{{
 if ( ! empty( $args['user_id'] ) ) {
 }}}
  filter by user is not created, and for non unauthorized user loaded data
 from all users. In my case I got an 120K rows for notifications and 20K
 extra request for DB in invitation.
 It's easy fixed with adding

 {{{
 if (empty($r['user_id'])) return [];
 }}}

 after "self::parse_args( $args );"

 In my case page generation down from 3.5 to 1.2, server load down to 40%
 of current.

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/8853>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list