I'm building a team roster and I've created a many-to-many relationship, so "roster years" are related to "players". A roster year example is "2018/2019". It can be assigned to many players and players can be assigned to up to 4 roster years.
I have a dropdown setup in the view "Search and Pagination" area to display the roster years. It's working fine.
Where I need help is writing the filter function to display the players that are related to the roster season value that's selected in the dropdown menu.
///////////////////////////////////////////////
// FILTER THE ROSTER VIEW BY SELECTED SEASON //
///////////////////////////////////////////////
function roster_season_func( $query_args, $settings, $view_id ) {
$ddl = $_GET['wpv-roster-season'][0];
if ( $view_id == 259 && isset($ddl) && !empty($ddl) ) {
//do something here to return players that are related to the selected roster year from the dropdown menu mentioned up above
}
return $query_args;
}
add_filter( 'wpv_filter_query', 'roster_season_func', 20, 3 );
Hello. Thank you for contacting the Toolset support.
Well - In order to help you with this issue I need to check what values configured with select dropdown.
Could you please share problem URL where you added the view and one test case example that if we select X option from dropdown what should be your expected output.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).
I have set the next reply to private which means only you and I have access to it.
Yes, I was testing some things to see if I could figure out a way to get the roster filter function to work. I won't make any more adjustments until I hear back from you now.