Skip to:
Content

BuddyPress.org

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#5480 closed enhancement (fixed)

Filters for new activity query

Reported by: mpa4hu Owned by: boonebgorges
Milestone: 2.0 Priority: normal
Severity: normal Version:
Component: Core Keywords:
Cc:

Description

I have spent long time building my custom queries and now when I finished and I updated to 2.0 I see that you have modified it.

http://wordpress.stackexchange.com/questions/132109/buddypress-add-activity-scope

Of course I can use bp_use_legacy_activity_query filter to use old one, but to be consistent it would be great if you created new filter for new query

in bp-activity/bp-activity-classes.php

Change History (5)

#1 @boonebgorges
7 years ago

The WHERE condition filter is still the same: https://buddypress.trac.wordpress.org/browser/trunk/bp-activity/bp-activity-classes.php#L388

But I think you can avoid both filters by passing a meta_query parameter to bp_has_activities(). This is much better practice than filtering the SQL directly.

#2 @mpa4hu
7 years ago

Well first of all, bp_has_activities has no filters to modify meta_query.
I remember I started from there but had no success.

Second and main reason why I dont even consider other solutions is that I also modify sorting.

https://gist.github.com/mpa4hu/9811714
here is a code to see what I am talking about.

and since in bp-activity-classes.php there is a check for sorting

if ( $sort != 'ASC' && $sort != 'DESC' )

$sort = 'DESC';

I have to hook there anyway.

#3 @boonebgorges
7 years ago

  • Milestone changed from Awaiting Review to 2.0

Gotcha. I'm not a huge fan of having these kinds of SQL filters in general, but your use case seems like it pretty much requires it.

BTW, looks like a cool plugin you're building. Are you going to share it? :)

#4 @boonebgorges
7 years ago

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

In 8187:

Add 'bp_activity_paged_activities_sql' filter, to allow last-minute filtering of activity IDs SQL query

Fixes #5480

#5 @mpa4hu
7 years ago

Thanks, yes it would be impossible without these filters.

Yes I'm going to host whole project on github with some opensource licence (probably the one you are using) and slowly put everything that can be usefull for others in one plugin.

For now its just collection of function.php bp-custom.php and one plugin for just handling ajax.

Actually I think "What's Hot" is good idea for buddypress - maybe you can think of better name but this gives some good experience in my opinion.

Also I have tags like stackoverflow where users can add their interests and filter with "interesting". if you are interested I can share everything I have.

https://dl.dropboxusercontent.com/u/13846290/Screenshot%20from%202014-03-28%2005%3A20%3A58.png
Anyways here is a screen of my interface now and I'm going to open it about at the same time Buddypress 2.0 will be released.
This is just a fun network based on anime "Durarara".

Note: See TracTickets for help on using tickets.