Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 19 replies - 1 through 19 (of 19 total)
  • @idlewanderer

    Participant

    I am fairly certain I already answered this.. Weird..

    Anyway, I managed to get in eventually. It seems the wrong password was saved in my browser. I got a new from WordPress and I finally got in. The ticket is in now, so let’s see if they do anything about it.

    @idlewanderer

    Participant

    Hm.. No matter what I do, it doesn’t seem like I can get into Trac.. I get no error when trying to login (such as telling me that the username or password is wrong), it just takes me back to the login page. I get the same even on my phone..

    @idlewanderer

    Participant

    Yes, still having issues logging in. Also tried another browser, but got the same issue.

    @idlewanderer

    Participant

    Thanks, I’ll try doing that.

    However, I can’t seem to log in to Trac.. It asks me to login, and when I do, nothing happens.. I just get sent back to the “you need to login” page.

    @idlewanderer

    Participant

    I even tried now to wrap everything in double quotes instead of single quotes, making it look like this (and continued to the end):

    function my_bp_activities_search_term_on_page_3431( $retval ) {
        // Add search term for correct page
        if ( is_page(3431) ) {
             $filter_query[] = array(
            "relation" => "OR",
            array(
                "column"  => "content",
                "value"   => "keast's tube-nosed fruit bat",
                "compare" => "LIKE"
            ),

    The function retained its functionality, but the term with the single quote still would not show..

    @idlewanderer

    Participant

    Thanks, but I’ve also tried that already. No error, but nothing shows up either..

    @idlewanderer

    Participant

    That solved it! Awesome! Thanks! 🙂

    @idlewanderer

    Participant

    I tried it, but it din’t work. At least it didn’t stop the filter rules already set up, like they did when I tried before.. So only words with lion shows up, but also sea lion.. Even with the code set up exactly like yours. Like this:

    function my_bp_activities_search_term_on_page_241( $retval ) {
        // Add search term for correct page
        if ( is_page(241) ) {
             $filter_query[] = array(
            'relation' => 'OR',
            array(
        'column'  => 'content',
        'value'   => 'lion',
        'compare' => 'LIKE',
        array(
            'column'  => 'content',
            'value'   => 'sea lion',
            'compare' => 'NOT LIKE'
        )
    ),
               array(
        'column'  => 'content',
        'value'   => 'lion',
        'compare' => 'LIKE',
        array(
            'column'  => 'content',
            'value'   => 'sea lion',
            'compare' => 'NOT LIKE'
        )
      ),
    );
        $retval['filter_query'] = $filter_query;
        }
     
        return $retval;
    }
    add_filter( 'bp_after_has_activities_parse_args', 'my_bp_activities_search_term_on_page_241' );

    @idlewanderer

    Participant

    Thanks for those! NOT LIKE did not work. Adding it only made the activity stream show everything. If I removed the array with NOT LIKE it went back to only showing results with the word lion again.. I also tried != with the same result.

    Would it help to have something other than 'compare' in front of it maybe? If I add NOT LIKE it probably adds everything that does not compare with the word “sea lion”, which overrides the arrays with LIKE. At least that’s my theory.

    @idlewanderer

    Participant

    Thanks! Great stuff! Is there any thing I can set instead of ‘LIKE’ if I want to exclude terms? It’s not that important, but if I could I’d try to avoid having posts about sea lions end up on the lion page.

    @idlewanderer

    Participant

    Yes! It works now! Thank you so very much! I guess I can add as many terms as I like now?

    @idlewanderer

    Participant

    Okay, so what I tried now didn’t work, but that’s because I really do not know what I am doing. I’m just testing the waters with what I learned from the search terms and the code you just posted. I ended up having my functions.php file looking like this:

    $filter_query[92] = array(
        'relation' => 'OR',
        array(
            'column'  => 'content',
            'value'   => 'philippine tube-nosed fruit bat',
            'compare' => 'LIKE'
        ),
        array(
            'column'  => 'content',
            'value'   =>  'nyctimene rabori',
            'compare' => 'LIKE'
        )
    );
    
    function my_bp_activities_search_term_on_page_92( $retval ) {
        // Add search term for correct page
        if ( is_page(92) ) {
            $retval['filter_query'] = $filter_query[92];
        }
     
        return $retval;
    }
    add_filter( 'bp_after_has_activities_parse_args', 'my_bp_activities_search_term_on_page_92' );

    And that clearly did not work, so what will work?

    @idlewanderer

    Participant

    I see, I kinda figured as much. So, how would I go about using one of those? I did a search, but couldn’t find anything that directly relates to what I need, at least not that I know of. How would I use meta_queryto do what I want? Is it similar to what I just did? I guess I can’t just replace the words “search_terms” with “meta_query” and I will be all set?

    Typical, I finally figured out how one thing works, and then I have to figure out something new.. Hehe

    EDIT: I see you already posted an example. Thanks! I’ll try it now.

    @idlewanderer

    Participant

    I just can’t seem to make it work..

    If I add this:
    $retval['search_terms'] = 'philippine tube-nosed fruit bat';

    I will only get result from people writing “philippine tube-nosed fruit bat”, but I also want to get results from people writing “nyctimene rabori”, as well (the latin name of the species). Or other variants of the name, such as plural versions and such. And I need the terms to be separated somehow. And that is what I can’t figure out..

    I need it to be something like this:
    $retval['search_terms'] = 'philippine tube-nosed fruit bat, nyctimene rabori';

    But then it won’t work.. As then only the enitre “philippine tube-nosed fruit bat, nyctimene rabori” will give results. And this one below just breaks my site:

    $retval['search_terms'] = 'philippine tube-nosed fruit bat', 'nyctimene rabori';

    I am getting really confused by this..

    @idlewanderer

    Participant

    I did manage to test it now, and it does work! I did have to change it from “bp_is_page()” to “is_page()”. Now it’s just figuring out how to add multiple search terms..

    @idlewanderer

    Participant

    I just realized that “bp_is_page()” might not work as the page I am referring to is a normal wordpress page. Is this so? If so, would “is_page()” be correct?

    @idlewanderer

    Participant

    Ok, I’ve fixed that now. Other than that it looks ok? I still can’t add multiple search terms the way I tried it though.. What is the correct way?

    @idlewanderer

    Participant

    Thanks! I think I got it now!

    I just added this to my functions.php:

    function my_bp_activities_search_term_on_page_92( $retval ) {
        // Add search term for correct page
        if ( bp_is_page(92) ) {
            $retval['search_term'] = 'philippine tube-nosed fruit bat';
        }
     
        return $retval;
    }
    add_filter( 'bp_after_has_activities_parse_args', 'my_bp_activities_search_term_on_page_92' );

    Do you think this will work? I do not have any ways to test if it actually works yet.. Another thing, how do I add multiple search terms? Everytime I tried adding another one I got an error, I tried doing this: $retval['search_term'] = 'philippine tube-nosed fruit bat', 'philippine tube-nosed bat', 'nyctimene rabori';

    @idlewanderer

    Participant

    Thanks! This certainly helps, but I still can’t figure out exactly what code to input or where to put it to make this work.. I undestand which code to use, I am just not exactly sure how to write it up and where to insert the search terms and such.. And what conditionals would I put? I am sorry, I can get really confused when it comes to coding.. It’s always hard for me to wrap my head around these things..

Viewing 19 replies - 1 through 19 (of 19 total)
Skip to toolbar