Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 1 replies (of 1 total)

  • Matt Cox
    Participant

    @mattamatic

    For the benefit of anyone else attempting to implement this, the above post is incorrect. Buddypress implemented @mention listing by searching the text of all activity updates. The function to query for activity (BP_Activity_Activity:get) allows you to query by user id AND search term, but not user id OR search term, as this feature requires.

    The only way I was able to get this working was by hacking bp-activity-classes.php, and updating the user_id sql in the get_filter_sql function. The updated code is as follows:

    `if ( !empty( $filter_array ) ) {
    $user_filter = explode( ‘,’, $filter_array );
    $user_sql = ” ( a.user_id IN ( ” . $filter_array . ” ) “;
    foreach ( $user_filter as $user_id ) {
    $search_terms = ‘@’ . bp_core_get_username( $user_id ) . ‘<';
    $user_sql .= “OR ( a.content LIKE ‘%%”.like_escape($search_terms).”%%’ ) “;
    }
    $user_sql .= ” ) “;
    $filter_sql[] = $user_sql;
    }`

    If someone has a more elegant solution, please let me know!

Viewing 1 replies (of 1 total)
Skip to toolbar