Support » Plugin: Events Manager - Calendar, Bookings, Tickets, and more! » How to sort EM_Booking object in my_booking template? And other questions.

  • Resolved Hankit

    (@hankit)


    Hi, before I go on, I’d like to commend the authors for maintaining one of the best documentation for a plugin I have ever seen.

    My problem is a little lower level than what the documentation answers, however.

    I want to know how to manipulate the EM_Booking object in the code. This is because the sorting used in [my_booking] is done using Booking Time and I need this to be sorted using Event Start Time.

    This will sound like some sort of PHP newbie question (It is), so bear with me for a while.

    Specific Major Issue:
    How do you sort the elements (rows) inside the EM_Bookings object?

    I have already tried (All are done on templates/my-bookings.php):
    1) Usort using the start time element appended into EM_Bookings when looped the first time to store into #event_ids[]. Result: PHP crashed when trying to process the appending Line: 11 (all line numbers are based on original my-bookings.php file)
    2) Usort EM_Bookings directly based on an element I found (via print_r) in there called event_start_time which is essentially the same thing. Result: No sorting happened, but PHP did not crash. Line: Usort inserted 1 line before line 51

    Observations:
    1) Having tried extracting information from EM_Bookings, I noticed that the displayed date is the Event Start Date, but it was extracted using another function call for EM_Event.
    Question 1: Why wasn’t the event_start_date from EM_Bookings used instead?
    Question 1a: Wouldn’t this save us an extra db query?
    Question 1b: If it’s because the data is unusable, shouldn’t it be cut from the Object itself?

    2) Events Manager (Even the non-pro version I am currently developing on) is at least 70% ready for offline education management.
    Question: Have you thought about making an education spin-off?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘How to sort EM_Booking object in my_booking template? And other questions.’ is closed to new replies.