how set the scope for the AJAX query with buddy press meta query

388 views Asked by At

I am trying to filter group with meta query with reference of bellow reference link code

https://gist.github.com/boonebgorges/2638943

This link code i have added in my function.php

and bellow code of spinet i have added in /wp-content/plugins/buddypress/bp-templates/bp-legacy/buddypress/groups/index.php in div groups dir-list

$meta_filter = new BP_Groups_Meta_Filter( 'group-custom-field-cat', 'Art and Culture' ); //print_r($meta_filter);
               echo @json_decode($meta_filter, true); 

Now if you visit the group page this code filtering the group which have meta key=group-custom-field-cat and value=Art and Culture.This workaround are good working.

On this same page i have to add one select box with option Art and Culture

If user select this option it will call the ajax query and run the bellow code so it will filter the group if have meta key and value like bellow.so how do i call ajax.

    <?php   if ($groupname=="Art and Culture"){
  $meta_filter = new BP_Groups_Meta_Filter( 'group-custom-field-cat', 'Art and Culture' ); 
                   echo @json_decode($meta_filter, true);
    }
   ?>  

working example:-http://tamrielfoundry.com/groups/

Can anyone know about this how to call ajax query which will fit to my need.

0

There are 0 answers