[buddypress-trac] [BuddyPress Trac] #7290: 2.7.0-rc2 breaks GeomyWP + Groups Locator groups list

buddypress-trac noreply at wordpress.org
Mon Oct 17 11:12:35 UTC 2016


#7290: 2.7.0-rc2 breaks GeomyWP + Groups Locator groups list
-------------------------------+------------------------------
 Reporter:  dreadedhamish      |       Owner:
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Groups             |     Version:
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |
-------------------------------+------------------------------

Comment (by ninjew):

 @DJPaul for sure.

 I took a quick look now and I found a couple of things that were modified
 and possibly caused my plugin to "break".

 One of the filters I used in order to modify the groups query is
 {{{
 bp_groups_get_total_groups_sql
 }}}

 . In the previous version of BuddyPress the FROM and WHERE clauses were
 added to the $sql array which passes to that filter.

 in line 778:
 {{{#!php
 <?php
 $sql['from']   = " FROM {$bp->groups->table_name_groupmeta} gm1,
 {$bp->groups->table_name_groupmeta} gm2,";
 }}}

 and line 784:
 {{{#!php
 <?php
 $sql['group_from'] = " {$bp->groups->table_name} g WHERE";
 }}}

 ( BTW, the $sql[group_from] array value, which I also use for modifying
 the query, is also gone in 2.7. )

 And in line 908, the SQL query which passes to that filter is created
 using a join:
 {{{#!php
 <?php
 join( ' ', (array) $sql )
 }}}

 However, in version 2.7 the FROM and WHERE clauses are missing from the
 $sql array and the SQL query is created in line 1093:
 {{{#!php
 <?php
 $paged_groups_sql = "{$sql['select']} FROM {$sql['from']} {$where}
 {$sql['orderby']} {$sql['pagination']}";
 }}}

 Now, to modify the groups query in my extension I have a custom function
 attached to the filter above. In the custom function I did something like:
 {{{#!php
 <?php
 $sql['from']  .= "my custom query.................";
 }}}

 and in the end of the function I return the value using join ( same way as
 BuddyPress plugin does in the previous version ):
 {{{#!php
 <?php
 return join( ' ', ( array )$sql );
 }}}


 However, with version 2.7 the returned SQL is missing the FROM and WHERE
 clauses which results in "no results".

 I hope that makes sense. It is 1:00 am here and my brain is half asleep
 :). So forgive me if the above is confusing or doesn't make much sense. I
 will look into everything again tomorrow morning after I have my coffee.

 Kind regards,

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7290#comment:14>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list