August 23, 2017 at 1:08 pm #56250
I want to direct the Search Posts plugin to instead of searching inside of the posts table in my database but to look inside my bp_activities table.
I have a function to geocode all incoming activities and are given an identifier associated with the activity all stored in places_locator in my database.
I’ve tried changing the $wpdb->posts.ID to $wpdb->bp_activity.id and other references to the posts I’ve changed to bp_activities in the gmw-pt-search-query-class.php but I still can’t seem to get it to work.
Would love to get this working asap, a current project requires this.
THANKS!!August 24, 2017 at 10:48 pm #56252
I am not sure that the way you are trying is going to work. GEO my WP indeed searches in both places_locator and in the wp_posts database tables. However, it does not search the wp_posts table directly, rather it uses the WP_Query class to do the job. So simply modifying the different parameters, such as $wpdb->posts.ID, is not going to work ( at least I don’t think it will ) since both WP_Query and the bp_activity search queries are different.
You will need to write a custom search query that will search for locations in the places_locator joining the bp_activity directly and get the results as an array or an object. Then you need custom functions that will loop through and display the locations.
The way I see it ( I might be wrong ), it requires more than just modifying the parameters in the core files.
FYI, what you are asking is on my todo list. I am waiting to finish up GEO my WP 3.0 ( which its first beta was released last week ) so I could start working on new features/extensions.
The new version has a new database structure and lots of functions and classes that can be used to extend GEO my WP.
You might want to look into it. It should be easier for developers to extend GEO my WP with new search objects.August 24, 2017 at 11:12 pm #56257
Thanks for the reply, I will definitely look at the beta version I hope that it’s easier to implement the Buddypress activities search functionality. I’ve read the beta release notes and it looks really nice. I like the centralized tables instead of multiple tables.
I know you are pretty busy with everything else but since it’s something on your to do list, do you happen to have a timeframe for some of the features/extensions you want to roll out?
I’ll keep chipping away at adding trying to add location search capabilities to bp activities.
—- A little bit of code help here —-
While looking at the wordpress global class $wpdb i notices that there are tables declared as public inside the class and saw that the plugin uses $wpdb->$posts.ID which refers to the posts table and the ID column. If I wanted to extend the $wpdb class using /wp-contents/db.php how would I go about adding the bp_activities table similar to the posts one mentioned above.
Thanks for the guidance and insight on my question. And thanks for the great plugin I look forward to testing out the beta version of GEO my WP 3.0
You must be logged in to reply to this topic.