buddy press activity loop, using the search_terms parameter....

I want to filter my activity loop to only contain blogs with certain keywords. Over here: http://codex.buddypress.org/developer/developer-docs/loops-reference/the-activity-stream-loop/

it says to use the search_terms parameter. I can only get this line of code to accept 1 keyword. I have a table of 20 keywords I want to filter the blogs by so that if they contain ANY of those keywords the blog should appear on my feed.

How do I do this?

Many thanks in advance,
Amit

  • PC
    • WPMU DEV Initiate

    Hiya,

    I tried to find an answer to it but it seems to be coding issue which is beyond the scope of support we can provide here on the forums. We provide support on general BP issues, the best place for coding support is the BP support forums

    Cheers, PC

  • Paul Barthmaier
    • Code Wrangler

    @amit_misra, I'm not a programmer, but wondering what the syntax of the statement is that you put in to get it working for the single keyword. Perhaps you can post it to inspire someone to help with the stringing the variable together.

    Hope this helps! Let us know how it goes.

    Cheers,
    Paul

    "Try it, you'll like it!"

    ~Advice from an Alka Seltzer ad.

  • amit_misra
    • Flash Drive

    we actually ended up using a custom script. if anyone has the syntax for multiple keywords we'd appreciate it. here is the custom filter we used:

    $i = 0;
    $all_feeds = array();
    $feeds_logo = array();
    $feed_logo = array();
    foreach($get_feed_key as $gf)
    {

    if(in_array($gf, $feed_keywords))
    {
    $all_feeds[] = $feed_urls[$gf];

    }
    $i++;
    }

    foreach($all_feeds as $feed_url)
    {
    $rss = fetch_feed($feed_url);
    $maxitems = $rss->get_item_quantity(1);
    $rss_items = $rss->get_items(0, $maxitems);

    foreach ( $rss_items as $item )
    {
    $flag = false;
    $get_content = explode(' ',$item->get_description());
    foreach($get_content as $get_w)
    {
    if(in_array($get_w, $get_filter_keywords))
    {
    $flag = true;
    }
    }

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.