Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Activity Meta – sql


  • jennifersanchez
    Participant

    @jennifersanchez

    Hi!
    I believe that my problem is in the sql query (although they work separately in my test in phpmyadmin) Im trying to filter a meta activity.

    `function Custom_Global_Search_Posts_sql( $sql, $args ) {
    global $wpdb;$bp;
    $sql = ” SELECT DISTINCT a.id FROM wp_bp_activity a INNER JOIN wp_bp_activity_meta ON (a.id = wp_bp_activity_meta.activity_id) WHERE a.is_spam = 0 AND (wp_bp_activity_meta.meta_key = ‘descr’ ) AND a.type = ‘activity_problem’ AND wp_bp_activity_meta.meta_value LIKE %s “;

    $query_placeholder[] = ‘%’.$wpdb->esc_like( $search_term ).’%’;
    $sql = $wpdb->prepare( $sql, $query_placeholder );
    return $sql;
    }`

    Thanks!!

  • You must be logged in to reply to this topic.
Skip to toolbar