Search / Filter Activity by Meta
-
I’ve added a category option to activity updates using the following code:
// Add Cat to Buddypress Activity Updates function my_custom_activity_meta_stuff( $content, $user_id, $activity_id ) { bp_activity_update_meta( $activity_id, 'bpcat', $_POST['bpcat'] ); } add_action( 'bp_activity_posted_update', 'my_custom_activity_meta_stuff', 10, 3 ); function add_bpcat_form_func(){ global $wpdb; $result = $wpdb->get_results ( "SELECT * FROM wp_bp_xprofile_fields WHERE id='2'" ); foreach ( $result as $print ) { ;?> <div class="bpcat <?php echo $print->id;?>"> In Search Of: <select name="bpcat" id="bpcat"> <option value="" disabled selected>Optional</option> <?php $options = $wpdb->get_results ( "SELECT * FROM wp_bp_xprofile_fields WHERE parent_id='$print->id'" ); foreach ( $options as $option ) { ;?> <option class="<?php echo $option->name;?>" name ="field_<?php echo $print->id;?>_match_any[]"value="<?php echo $option->name;?>"><?php echo $option->name;?></option> <?php } ;?> </select> </div> <?php } } ; ?> <?php add_action('bp_activity_post_form_options', 'add_bpcat_form_func');
What I’d like now is to be able to either filter the sitewide activity feed by category or include the activity metas in what is search by /common/search/search-form.php
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.