Including subscriber users in search results
-
Hi there. We’re using Relevanssi Premium and have the “index and search user profiles” and “index subscriber profiles” options checked. We would like to include only a specific subset of users, which are members within the Paid Memberships Pro subsystem. These users are all contained within the wp_users table, but also have a record in the wp_pmpro_memberships_users table which indicates whether they’re active or not.
And before I forget, here is the pastebin of our search.php template. We are using the “Flatsome” theme by UX Themes:
So, one question and one problem:
1. Is it possible to include users (plus subscribers) in the search index, but further restrict the index to members (users) that are active? I’ve been reading about the posts_clauses filter in WordPress to see if that could be used to add the required join to this pmpro table.
2. With the two options above checked, to include subscriber and other users in the search index, when I run a search I get an incomplete search results page that ends when it tries to render the first user in the results. This is the error, which includes a print_r of the “post” object that it is failing on:
WP_Post Object ( [ID] => -1 [post_author] => 0 [post_date] => 2014-09-30 03:15:01 [post_date_gmt] => 0000-00-00 00:00:00 [post_content] => [post_title] => [post_excerpt] => [post_status] => publish [comment_status] => [ping_status] => [post_password] => [post_name] => [to_ping] => [pinged] => [post_modified] => 0000-00-00 00:00:00 [post_modified_gmt] => 0000-00-00 00:00:00 [post_content_filtered] => [post_parent] => 0 [guid] => [menu_order] => 0 [post_type] => user [post_mime_type] => [comment_count] => 0 [filter] => raw [link] => WP_Error Object ( [errors:WP_Error:private] => Array ( [invalid_taxonomy] => Array ( [0] => Invalid taxonomy ) ) [error_data:WP_Error:private] => Array ( ) ) [term_id] => 406 [relevance_score] => 369.33 [original_excerpt] => ) -1<article id="post--1" class="post--1 user type-user status-publish hentry"> <header class="entry-header text-center"> <h1 class="entry-title"><a href="<br /> <b>Catchable fatal error</b>: Object of class WP_Error could not be converted to string in <b>/home/nhmadehq/public_html/wp-includes/formatting.php</b> on line <b>3030</b><br />
Thank you very much for your help!
- The topic ‘Including subscriber users in search results’ is closed to new replies.