Support

Home Forums Event Espresso Premium Hiding Expired Events on User Profile Page

Hiding Expired Events on User Profile Page

Posted: April 30, 2018 at 2:48 pm

Viewing 8 reply threads


mdeyerinkc

April 30, 2018 at 2:48 pm

I only want future events for which a user is registered to display on their profile page when using the [ESPRESSO_MY_EVENTS] shortcode. I tried using the guidance from this post, https://eventespresso.com/topic/any-way-to-hide-expired-events-in-the-espresso_my_events-shortcode/, but it’s not currently working. I think it was working at one point (I’ve been doing a lot of development tweaks in recent weeks, so it’s hard to keep track), but it any event it isn’t working now.

Any suggestions? Did something change with a recent update?


Josh

  • Support Staff

April 30, 2018 at 2:54 pm

Hi there,

An update would not have changed this. May I ask can you clarify what you mean by “not currently working”? Does that mean that all expired events are being displayed on the user profile page, or is it only some of them? Can you post a link to one of the expired events that is being displayed so we can investigate further?


mdeyerinkc

April 30, 2018 at 3:14 pm

You must login to see the courses. I’ve created a login account for you. Do you have a way for me to send you the un/pw?


Josh

  • Support Staff

April 30, 2018 at 3:31 pm

We do, but that’s probably not necessary and I think we can avoid sending credentials via forms.

Are all expired events being displayed? If so are these events also flagged as sold out?

If so, you will need to make a slight adjustment to the template so expired events that are also sold out are not included in the list.


mdeyerinkc

April 30, 2018 at 3:37 pm

Nope – the event was not sold out. It was a one-day training with four seats “unsold” [we don’t actually sell seats – but attendance is restricted to our organization.]

Following your guidance from the post in 2016 I referenced, I created a child template file for content-espresso_my_events-event_section.template.php, and added the line you offered. So it currently looks like…

<?php
if ( $event->get_active_status() == 'DTE' ) { return; }

/**
 * Template for the "event_section" content template for the [ESPRESSO_MY_EVENTS] shortcode
 * Available template args:
 *
 * @type    EE_Event $event              event object
 * @type    string   $your_tickets_title title for the ticket.
 * @type    int      $att_id             The id of the EE_Attendee related to the displayed data.
 */
$registrations = $event->get_many_related('Registration', array(array('ATT_ID' => $att_id)));
?>
<tr class="ee-my-events-event-section-summary-row">

I omitted the rest of the code for brevity.


Josh

  • Support Staff

April 30, 2018 at 4:10 pm

If you make any other edits to that same template are those edits displaying when you refresh the page?


mdeyerinkc

April 30, 2018 at 4:14 pm

That’s exactly what I’m trying to test right now, but I think the answer is no.

I copied the original file to the themes/education-zone-child folder using cpanel, and then tried performing edits via the WP Appearance->Editor menu. But I’m not exactly sure what I should edit to look for an identifiable change. Suggestions?

I also just noticed that the “Dates & Times” column is not displaying in the simple list. I currently have Title, Ticket, Location, and Action columns – but no Date/Time.


Josh

  • Support Staff

April 30, 2018 at 4:26 pm

Something like a echo '<h1>test</h1>'; immediately after the opening PHP tag would give you a visible indication you were editing the correct template.

What may be happening is you’re editing the wrong template. If the shortcode is
[ESPRESSO_MY_EVENTS template=event_section]
then you’re editing the correct template.
If the shortcode is
[ESPRESSO_MY_EVENTS template=simple_list_table]
then you’ll need to make the edits to the
content-espresso_my_events-simple_list_table.template.php template file.


mdeyerinkc

April 30, 2018 at 4:40 pm

Winner winner chicken dinner! That was the problem. I was using [ESPRESSO_MY_EVENTS template=simple_list_table your_events_title=’Alternate Title’] to change the header. Deleting the template=simple_list from the shortcode fixed the issue.

Viewing 8 reply threads

The support post ‘Hiding Expired Events on User Profile 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.

Event Espresso