Events Made Easy Forums Feature requests Recurrences: multiple Times per Event

  • This topic has 11 replies, 2 voices, and was last updated 7 years ago by gmh.
Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #52543
    gmh
    Participant

    I’m in the situation that I have an recurrence event (multiple dates) and every event can occur at two times.
    It is for the webpage of a theater. An example:
    The play “Snow white” will be played at July 6th, 10th, 11th and 20th at 09:00, 15:00 and 18:00 o’clock.
    I didn’t find a solution for this problem, so I post it as a feature request.
    Thanks in advance.

    #52546
    Franky
    Keymaster

    Well, you can just duplicate another event and change the hours, for the moment that is the only solution.

    #52547
    gmh
    Participant

    Okay, I tried this. But unfortunately I can only duplicate an event not a series. So I had to change my series into several events. But then I ran into troubles with my functions, because they are based on recurrences.
    So, the only solution at the moment is to create an event with the first time and then to write in the event details “plays also at 15 and 18 o’clock”. Not perfect but usable…

    So it would be really great if you could add multi-event-times to recurrences.

    #52548
    Franky
    Keymaster

    You can duplicate an event and then edit that new event and make a recurrent event out of it.

    #52549
    gmh
    Participant

    Yes, but that would be a new recurrence and has a new id. So it won’t be displayed in the event list according to the existing event but as an extra event.

    #52935
    gmh
    Participant

    Okay, I have another idea: I duplicate an event and make a recurrence event out of it with the second time. Than, I change the recurrence ID in the database to the id of the original event. Would that work? If yes, this could be a solution, because I have only very few events with more than one time, so I could change this manualy. What happens, if I edit this event?

    #52936
    Franky
    Keymaster

    That’s an interesting way of doing things. It should work fine, as long as you don’t edit the recurrence after that.

    #52945
    gmh
    Participant

    Yeah and thats the problem 🙁
    I feared that my “solution” did work only until I re-edit the recurrence.
    Do you have another idea, how I could solve this?

    #52947
    Franky
    Keymaster

    Honestly no, not without needing to change just about every bit of code in the plugin to account for multiple time-fields.

    Although … using the eme_update_recurrence action hook, you could always copy all the events related to the second recurrence to the first. So:
    – create your first recurrence
    – create your second recurrence
    – create a action hook hooking into eme_update_recurrence, that copies all events related to the second recurrence to the first (and maybe change the category they belong too, so you could hide the second recurrence based on it’s category)

    #52963
    gmh
    Participant

    Thats a great idea. I’ll try it and post the results.

    I think I only have to copy the recurrence ID from the first recurrence to all events of the second recurrence (and not the complete events).

    #52966
    Franky
    Keymaster

    You should copy the events, because they will be gone when editing the recurrence otherwise.

    #52969
    gmh
    Participant

    I tried a lot (and read your code) but finally failed 🙁
    I saw, that (in db) all recurrences are events with the same contents. In the recurrences-table they are organized.
    I tried to copy an event but I’m not sure how to do this “revision-safe” (I don’t want to rewrite my code for every new release of eme or wp).
    I must say, that I can code php but I have only small experiences in writing wp-plugins. And I fear if I use “raw” mysql INSERTs etc. I run into trouble…

    I solved the problem another way: I added an attribute “TIME2” and I changed the event-title, event-list etc. so it displays the STRING inside the attribute if it exists. So, I can display: Eventtitle 20:00 also playing 22:00 o’clock (the Attribute in this example would be “22:00” and the formula in the event-list-setting would be: #_{l, d.m.Y - H:i} [eme_if tag='#ESC_ATT{Time2}'] also playing #_ATT{Time2}[/eme_if] o'clock

    Its not as perfect as the other solution (if I somedays add reservations it will break) but for the moment it works.

    Thanks again for your help and a great plugin!

    (If on the other hands you could post some code how to revision-safe copy events, I’ll try the better solution again 🙂
    My idea was to add an attribute Time2 which holds only the time (22:00). In the eme_update_recurrence hook I would than check if the attribute Time2 exist and read it. Than I would search for the recurrence id that matches the title of the actual event (that must be exist, see below), copy it and change the recurrence id of the actual event to the recurrence id of the copied event. That needs a two step creation: 1. I create an recurrence as everytime WITHOUT setting attribute Time2. 2. I edit this recurrence and add Time2. Could this work?)

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.