Skip to content
This repository has been archived by the owner on Sep 22, 2021. It is now read-only.

Multi-word column names aren't supported by filter #16

Open
waldoj opened this issue Nov 24, 2013 · 2 comments
Open

Multi-word column names aren't supported by filter #16

waldoj opened this issue Nov 24, 2013 · 2 comments
Labels

Comments

@waldoj
Copy link
Contributor

waldoj commented Nov 24, 2013

Filtering by single-word column names (e.g., chamber, size, state) works fine, but filtering by multi-word column names (e.g., region code, Building State) does not, even with those column names are URL encoded (e.g., region+code or region%20code). Add in support for URL-encoded multi-word column names, and document the need to URL encode them (as opposed to represent spaces with hyphens or underscores).

@waldoj
Copy link
Contributor Author

waldoj commented Mar 11, 2014

The problem here appears to lie in WordPress's list_filter() function.

@waldoj
Copy link
Contributor Author

waldoj commented Mar 12, 2014

As it turns out, the problem is a lot deeper than that. The problem is within query(), which doesn't sanitize column names as it compares them to the input in the URL. So region code isn't matched to region_code, and it's discarded.

That's fixed pretty easily, like such:

// Fill in any defaults that are missing.
$query_vars = $this->get_query_vars( $data );
foreach ($query_vars as $key => $value) {
   unset($query_vars[$key]);
   $query_vars[ str_replace(' ', '_', $key) ] = $value;
}

Then the problem is with list_filter(), because that also isn't making the proper comparison. So I've gotten partway done with this, but there's more to do.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant