Posted: October 30, 2018 at 9:11 am
|
In regard to this post: I have added a a custom meta field to events… as well as a custum column and filter to show/filter based on the value. However, I am stuck now and do not know how to acutally apply the filter when click on the “Filter” button. It does not save the selection nor does it filter by the selection. How did I create the filter: I used the list_table_functions in Extend_Events_Admin_Page.core.php as a foundation and added it via a filter: Now,I try to actually apply the filter and save the selection. But I do not know how to do it. I found a filter |
Hi there,
This may seem nit-picky, but you don’t save the selection, when you select a filter and click to submit, it POST’s back to the server with your selection and for it to show the current selection you just made, you’ll need to add logic that checks for your post var and displays the current selection. That’s all separate from the filtering of events based on the selection so I’d start with figuring out how to filter the events based on your selection and work from there. The filters you mentioned above are incorrect, you’ll need to filter the query used to pull in the events for that section, so you’ll need:
Which is passed the What you do from there depends on where/how you are storing the data, but as an example if you store the day of the week in post_meta with the key ‘day_of_the_week’ and the value is Monday you’d have something like this:
Although you’ll want to pull the value from If your not using post meta, you’ll need to post your code to either a Gist os PasteBin so we can view it. |
|
|
Thanks Tony, I will check it out asap. Meanwhile, in my table content call back, which I added like this: …I am trying to call _get_first_related, but it returns an error:
Error: It says _get_first_related does not exist in EE_Event. However, it should exist since it is derived from EE_Base_Class:: too, isn’t it? What am I missing. Basically what I am trying to do is to select the first datetime of that event in order to extract that day. What would be the best approach? |
Hi, It looks like you’ll need to remove the leading underscore e.g. |
|
|
Well, that worked great. Noob I am. ๐ Now I am stuck at another, probably trivial problem. Any tips appreciated. Thanks. |
|
Ok, found it. It was “hidden” in the taxonomy term. This works.
|
|
@Toni,I checked your post and I got it working. I have posted the whole class in pastebin: https://pastebin.com/RqEQcsxQ The problem is, that in the function acms_espresso_event_days_dropdown the value of the current req_data is missing/protected. This leads to the problem that I cannot provide the current filter selections to How to get the data to restore the selection values? Or is the way I coded it totally broken and wrong? How to code it more elegantly and the way it works? |
|
sorry, I meant @Tony ๐ |
Pull the current admin page object from the list table, that object has a So something like:
Or pull the data directly from |
|
|
My man! Great stuff. Works and issue resolved. Thanks a lot. |
The support post ‘Handling Filters on the event list admin page’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.