Posted: October 31, 2024 at 12:17 pm
Is it possible to sort the events dashboard by date on load? |
|
To clarify, we know you can click the headings in the table, but we’d like the initial sort order to be by the events date. |
|
A couple of additional questions from my client if you don’t mind, or I can open separate threads… > If someone registers for an event and an account is created for them, will subsequent registrations with the same email address appear in that users account? > While doing a test registration, I couldn’t find a way to go back to the Registration/Attendee Information screen after proceeding to payment options. I imagine someone might need to go back to correct a name misspelling or email address, etc. Is this possible? |
|
Hi there,
Yes, its possible using a snippet like this: https://gist.github.com/joshfeck/3ad962e282219f922021ebf55d6d79e2 That just sets the filters using the Query string for the menu item and as it stands orders ASC and only upcoming events. From the above you’ll likely need something like:
Only if using the same First Name, Last Name and Email, but yes. Note for this to work they need the WP user integration add-on active.
Not from Payment Options to Attendee info no, they would need to restart the registration currently. However, the thank you page does have the option to edit the registrant date and a link can be included in the emails if needed. |
|
Great, thanks for the info! One more related question, is there a filter on the “Overview” tab link as well? https://imgur.com/a/ardJdiM |
|
Not that I can see but I’ve asked one of our devs to double check. |
|
Have you heard back about this question? We’d also like to modify the “Event Espresso” link in the admin toolbar… our client is very pick about ordering. Additionally, is there any way to adjust the query used on the overview page? We’d like to exclude a specific category unless it’s explicitly selected. |
|
Somewhat related… 1. The filters on the “Overview” page don’t seem to be working correctly; for “Select a Month/Year” we only see “September 2025,” but there are many events in other months. |
|
Currently you can’t filter those URLs, not the overview or admin toolbar menu (we’ll technically you can with the admin bar but you would need to use the
Yes, and actually you would be better using that to filter the default covering and leave the URL’s as they are. The hook to filter the query is To change the default ordering you can do something like this: https://gist.github.com/Pebblo/833a66cc6a191b7df99a72b53727a01f (Remove the snippet I get you above HERE) If you change the default ordering that will apply to all locations when no additional filtering is set.
Hmm, strange. Have those events been published? Is this with no other filters applied?
A filter to add an additional filter for a range to apply? If so there’s a dynamic filter for this:
For the EE event list table the hook name would be You can apply the values to the query using the same filter from above
Yes, you’d use with the same filter above or
Either of those can be used to add additional conditions when searching. |
|
Thanks, I’ve got the default sorting working, but struggling with pretty much everything else… In
return $where; |
|
Yeah, usually the dates don’t even populate. I’ve seen it show one month, but right now it shows “Select a Month/Year” with no options. This is with no other filters applied. |
|
Similarly for the venue filtering, I just don’t understand how your hooks work. Can you provide me an example of how I’d filter the results using the |
|
Sorry, I assumed you’d reviewed our model system previously so I didn’t provide details on using them. For this…
You need to review this doc: In short this:
(NOT_IN expects an array of values, even just 1) Side note – your code is currently completely replacing ALL values of WHERE with the code to just exclude the category, meaning if anything else is set it’ll be replaced/ignored.
I’ll need more details on what you doing with venues to give you an example. However, the best example I can give you here is to point you to how the current filters work. If you search our codebase for Within that class you’ll see this code for filtering by Venue:
If a venue (ID) is set pass that to the model for the related Venue.VNU_ID. All of the model query params work in the same way so once you follow how those params work you can apply it to pretty much every model/query you want… without in-depth knowledge of the joins going on in the background.
No, the models handle all of the various joins, converting the params to the correct DB columns, etc. Ultimately they use wpdb so if you really wanted to dig that deep you could but I don’t advise it, or support it. The models make querying EE data much easier and you can do some really powerful querying with ver minimal code, I highly recommend browsing the above docs, the time taken will be a huge timesaver when working with EE data. https://github.com/eventespresso/event-espresso-core/tree/master/docs/G–Model-System |
|
I’ve separated this out into another reply as it’s not related to the filtering above. This is strange and will need some investigation. If you don’t have it already installed Query Monitor: https://en-gb.wordpress.org/plugins/query-monitor/ Then go to EE -> Events. Open query monitor from the admin bar. Go to Database Queries. Filter caller by – EEM_Base->_process_wpdb_query() Component by – Plugin: event-espresso-core-reg Search the queries for When you find one that looks like this: https://monosnap.com/file/KifCI7C4RxRlDwOZUWGTxdLUT5S8aR Open up the caller and confirm it’s from the What is the query there? By default it should be:
Try running that directly, do you get results from the query? |
|
Thanks, I’ll look in to these items today, I appreciate the help. When I run that SQL query, I get this response: #1055 - Expression #3 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'mytablename.Datetime.DTT_EVT_start' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by |
|
This link 404s for me, I’m assuming this stuff’s not available publicly https://github.com/eventespresso/event-espresso-core/blob/master/docs/G–Model-System/model-query-params.md#different-operators
Is there a way to convert it to an array of conditions then, so I can keep existing conditions while appending my own? |
|
Apologies for the third response: By filtering by venue, I mean that we want to allow an administrator to enter, for example, “Chicago, IL” and find all events associated to that location. This would be in the “All Events” dashboard area. And here’s what the query looks like for the “generate_event_months_dropdown” call on the dashboard. SELECT YEAR(DATE_SUB(DTT_EVT_start, INTERVAL 6 HOUR)) AS dtt_year, MONTHNAME(DATE_SUB(DTT_EVT_start, INTERVAL 6 HOUR)) AS dtt_month, MONTH(DATE_SUB(DTT_EVT_start, INTERVAL 6 HOUR)) AS dtt_month_num FROM wp_esp_datetime AS Datetime LEFT JOIN wp_posts AS Event_CPT ON Event_CPT.ID=Datetime.EVT_ID LEFT JOIN wp_esp_event_meta AS Event_Meta ON Event_CPT.ID = Event_Meta.EVT_ID WHERE Datetime.DTT_deleted = 0 AND ( (Event_CPT.post_type = 'espresso_events')) AND Event_CPT.post_status = 'draft' GROUP BY dtt_year, dtt_month ORDER BY Datetime.DTT_EVT_start DESC |
|
No, it’s public but I remember this happening previously. The forum is escaping the
It is already an array, but your code replaces the current variable with your own array instead of adding/replacing the values within it:
Replace Vs:
Adds additional elements to the current array, replacing them if already set. There may be other elements set within where that you’ll want to keep. —
Oh for the search value you mean? Take a look in —
That looks valid, what happens when you run that SQL? |
|
Thanks, I’m trying to pick this up again this week… Regarding the Month/Year filtering, when I run that SQL query directly in phpMyAdmin, I get this error:
I’ll look in to the other items and report back. |
|
Oh yeah! You’ll get that with the above query when Can you send me a copy of the |
|
This reply has been marked as private. | |
Okay, an update on everything so far… I was able to get searches to include venue names with this:
/**
* Modify event dashboard search to include venue name
*/
add_filter("FHEE__Events_Admin_Page__get_events__where", function (array $where): array {
/**
* Ensure it's the Event Espresso dashboard
*/
if (! (isset($_GET["page"]) && $_GET["page"] === "espresso_events")) {
return $where;
}
/**
* Ensure it's a search
*/
if (! (isset($_GET["s"]) && $_GET["s"])) {
return $where;
}
/**
* Ensure the "OR" key exists
*/
if (! array_key_exists("OR", $where)) {
return $where;
}
/**
* Append the
Works perfectly as far as I can tell. Next, I was able to figure out how to filter out events with a specific category, but it only works if the event is *only* in that category. That’s fine with me, but my client might complain; is there any way to adjust this to exclude these events even if they’re in other categories?
/**
* Exclude events in
Sorting events in the dashboard by date was easily done with this:
I’ve also got event dates mostly showing up throughout the checkout process, but is there any way to add them to the invoices such as Here’s how I’m displaying the date otherwise: /** * Display event dates during the checkout process * * @param string $value * @param EE_Line_Item $line_item * @return string */ function pofo_child_event_espresso_insert_date(string $value, EE_Line_Item $line_item): string { if (($event = $line_item->ticket_event()) && ($date = pofo_child_event_espresso_event_get_date_range($event->ID(), "F j, Y"))) { $value = "{$date}<br />{$value}"; } return $value; } add_filter("FHEE__EE_Event_Cart_Line_Item_Display_Strategy___ticket_row__name_and_desc", "pofo_child_event_espresso_insert_date", 10, 2); add_filter("FHEE__EE_Default_Line_Item_Display_Strategy__item_row__name", "pofo_child_event_espresso_insert_date", 10, 2); add_filter("FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__name", "pofo_child_event_espresso_insert_date", 10, 2); Think that’s all for now… |
|
Just a couple of notes from the above:
The current Request Params are passed to the filter as a 2nd parameters, so against whilst there’s nothing technically wrong with using $_GET, why not use the values from So: Then:
Nothing wrong with this per say, but that hook will only ever fire on that specific request, so this will work but is redundant. Why check for OR:
If its a search request (which is what sets OR) you want to add your own search params. A search request will always have OR set unless something else has filtered the request to remove it… in which case you now don’t want to include Venue Name as a search param?
Again, I’d recommend using
Do you mean when selecting another category to show in the table or just in general? Any vent set in in more than one category will still display when excluding one of the categories with the above?
Nice.
Can you link me to an invoice and highlight where you’d like to add them? I’ll check into this from there. |
|
You must be logged in to reply to this support post. Sign In or Register for an Account