// BuddyBoss (Groups)- Adds the current group ID to a field in Formidable Forms. add_filter('frm_get_default_value', 'bb_group_id_finder', 10, 3); function bb_group_id_finder( $new_value, $field, $is_default ) { $group_id = bp_get_current_group_id(); // Finds the ID of the group that's currently visible on the page. if ( $field->id == 28 && $is_default ) { // 28 is the field we're writing to $new_value = $group_id; // Switch the value to be our called Group ID } return $new_value; } // BuddyBoss (Groups)- Use the current Group ID to filter our view in Formidable Forms. add_filter('frm_filter_where_val', 'bb_group_id_to_ff_view_filter', 8, 2); function bb_group_id_to_ff_view_filter( $where, $args ) { $group_id = bp_get_current_group_id(); // Finds the ID of the group that's currently visible on the page. if ( $args['display']->ID == 164 && $args['where_opt'] == 28 && isset( $group_id ) ) { $where = $group_id; } return $where; }The final piece of the puzzle is checking to see if the view has a matching entry. If it does, we show the resulting entry and place an edit button below. If there isn't an entry, we'd like to just show the form or a button to edit instead. Is there a function that I could call within my functions.php that could help to handle that?
[entry_count]
shortcode will show you the number of entries in a filtered view when placed in the Before Fields or After Fields section of the view.
If you have pagination turned on it will show you the total across all pages, not the total for the current page.
By the sound of it though this might not be what you're looking for? If you want to filter a view based on the value of a field (and you can't do it with the standard filters) you can do it with the frm_where_filter
or frm_filter_where_val
hook.Glad i could help out 🙂
Please login or Register to submit your answer