Support

Home Forums Event Espresso Premium Adding author filter to events view

Adding author filter to events view

Posted: March 19, 2020 at 5:59 am


Oguzhan Altun

March 19, 2020 at 5:59 am

Hello,

Would it be possible to add an author filter to the espresso events admin view?

We use the event author field to assign each course to an instructor, so it would be very useful to us to have this.


Tony

  • Support Staff

March 20, 2020 at 6:48 am

Hi there,

Yes, this is possible but we don’t have any snippets that will do it for you.

The events list table filters run through a filter:

FHEE__Extend_Events_Admin_List_Table__filters

And then the ‘where’ array for the query to pull the events using our model system is pass through:

FHEE__Events_Admin_Page__get_events__where

You can find docs on using our model system here:

https://github.com/eventespresso/event-espresso-core/tree/master/docs/G–Model-System


Oguzhan Altun

March 20, 2020 at 12:01 pm

Hi Tony,

Actually a developer had written a snippet for this purpose, but it stopped working some time ago. I have no idea why as I don’t know programming. Maybe you could have a look to see if you can make it work again?

https://gist.github.com/altuno/58698c7b0277bb35ff39e92e96eeff97


Oguzhan Altun

March 20, 2020 at 12:09 pm

it had one bug that a user could not filter for himself, but filter worked for others


Tony

  • Support Staff

March 20, 2020 at 3:13 pm

We (Event Espresso) can not provide support for other users code but I can tell you that it’s using JavaScript to filter the events after the query has pulled them all in. The filters I provided above give you a better method of doing this without resorting to hacking things together with Javascript like the above does.

Any issues with JS on the page would prevent the above from working so in short, that code is ‘doing it wrong’ and even if you ‘fixed’ it it would still be fragile.

Adding a filter based on the author is something we could likely add for you using a support token if you’d like to go down that route.

The support post ‘Adding author filter to events view’ 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.

Event Espresso