add_filter('frm_where_filter', 'my_unique_name_filter_custom_display', 10, 2); function my_unique_name_filter_custom_display($where, $args){ $view_id = bsn_get_post_id_from_slug('slug-of-view'); // replace 'slug-of-view' with your view slug $field_id = bsn_get_field_id_from_key('field-key'); // replace 'field-key' with your field's key if ( $args['display']->ID == $view_id && $args['where_opt'] == $field_id){ $user_id = $_GET['trainer']; // change trainer to the name of the parameter in your URL if ( !is_numeric($user_id) ) { // if the username was in the url, get the ID $user_id = FrmProAppHelper::get_user_id_param($user_id); } if ( is_numeric($user_id) ) { $where = ("meta_value = ". $user_id ." and fi.id='". $args['where_opt'] ."'"); } else { // no matching user ID was found $where = ("meta_value = 1 and meta_value = 0 and fi.id='". $args['where_opt'] ."'"); } } return $where; } if (!function_exists('bsn_get_post_id_from_slug')) { function bsn_get_post_id_from_slug($slug) { global $wpdb; $id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_name = '$slug'"); return $id; } } if (!function_exists('bsn_get_field_id_from_key')) { function bsn_get_field_id_from_key($field_key) { global $frmdb, $wpdb; $field_id = $wpdb->get_var("SELECT id FROM $frmdb->fields WHERE field_key LIKE '".$field_key."'"); return $field_id; } }
Subscribe To Our Newsletter
Join our mailing list to receive the latest news and updates from our team.
You have Successfully Subscribed!