Getting a frontend warning when "Search in buddypress activities" is turned on

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Getting a frontend warning when "Search in buddypress activities" is turned on

This topic contains 4 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 6 years, 10 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #13267
    catonezillion
    catonezillion
    Participant

    Hi,

    Love this plugin! I installed it and ran a search with the sidebar widget and now I’m getting the warning shown below. When I click “More results” at the bottom of the search box, the warning shows up on the front end at the top.

    In settings, on the Compatability checker, there was a message of no issues with the CSS and JS tab, and I turned off the custom ajax handler.

    The warning doesn’t show up if I turn off “Search in buddypress activities” in General Options/Buddypress.

    Warning: array_merge(): Argument #1 is not an array in /home/XXXXX/public_html/wp-content/plugins/ajax-search-pro/includes/classes/search/class-asp-query.php on line 700

    Line 700 is the line starting with $ra below
    if ( in_array(‘buddypress’, $args[‘search_type’]) ) {
    $_buddyp = new ASP_Search_BUDDYPRESS($args);
    $buddypresults = $_buddyp->search($s); // !!! returns array for each result (group, user, reply) !!!
    foreach ($buddypresults as $k => $v) {
    $ra[‘allbuddypresults’][$k] = array_merge($ra[‘allbuddypresults’][$k], $v);
    }
    $this->found_posts += $_buddyp->results_count;
    }
    do_action(‘asp_after_buddypress_results’, $s, $ra[‘allbuddypresults’]);

    I’m using the latest versions of WP and Buddypress with the KLEO theme.

    I don’t think this is related, but clicking the “More results” also seems to trigger running the search via the theme search, and the search results show up on the main page content area (url ends with /?s=event). I read in the documentation that with some themes I have to add the do_shortcode command to the theme file- Does this sound like a problem that will be solved by doing that?

    Any suggestions?

    Thanks
    Cathy

    #13286
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    Looks like that is a yet unknown bug there. Luckily it should not affect anything, it is only a warning message.
    If you want to get rid of it, just change line 700 in that file from this:

    $ra['allbuddypresults'][$k] = array_merge($ra['allbuddypresults'][$k], $v);

    to these 3 lines:

    if ( !isset($ra['allbuddypresults'][$k]) )
        $ra['allbuddypresults'][$k] = array();
    $ra['allbuddypresults'][$k] = array_merge($ra['allbuddypresults'][$k], $v);

    That should do the trick 🙂

    The second issue I’m not sure I understand correctly, but adding that code will very likely not help. Can I take a look at it somewhere?

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #13295
    catonezillion
    catonezillion
    Participant

    Hi Ernest,

    Thanks for getting back to me so quickly! I’ve give this a shot and let you know what happens.

    Cathy

    #13346
    catonezillion
    catonezillion
    Participant

    Hello,

    This seems to have fixed it- thanks so much!

    I have a related question – let me know I need to start another thread: I read in the comments section on envato that the index table doesn’t include user (buddypress) data. So if I use the index search, then will users never show up in the search results, or will they show up but in a separate section or group?

    Thanks,
    Cathy

    #13350
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi Cathy,

    I’m glad it worked!

    It only means that the user search is not conducted using the index table engine, but they will still show up regardless as before. The index table engine will apply to post type related search, other things like users, terms etc.. will still be returned the same way.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.