Events Made Easy Forums How do I … …adjust the number of days till start?

Viewing 26 posts - 1 through 26 (of 26 total)
  • Author
    Posts
  • #62575
    Anonymous
    Inactive

    Me again.

    It seems that a placeholder like #_DAYS_TILL_START is showing one day less. It might be correct when calculate hour-wise, but it is misleading in the way we use calenders and count days.

    When for example visiting during the 26.5. the page of an event that will happen on the 29.5. it should show that there are three days left nevermind which time it is and which time it will start, but I get the info that there are two days left.

    Is there a way to adjust this?

    #62576
    Franky
    Keymaster

    That’s why I added #_DATETIMEDIFF_TILL_START (which will give more complete info).

    #62577
    Anonymous
    Inactive

    But as I saw it, it is the same, no?

    If I go with #_DATETIMEDIFF_TILL_START{d} it will show 2 days instead of 3, when the difference is something like 2 days 23 hours …

    #62580
    Franky
    Keymaster

    Just use #_DATETIMEDIFF_TILL_START (without formatting) to show years, months, days, hours, minutes …

    #62584
    Anonymous
    Inactive

    I understand how it works, but I don’t really want an exact countdown. It is more this casual information about the days left. How many more nights to sleep till it starts.

    Might it be possible to implement something like a round up parameter? Round up the days if xx hours left?

    #62585
    Franky
    Keymaster
    #62586
    Anonymous
    Inactive

    Unfortunately no. But I think that another error has crept in, because almost all placeholders are no longer interpreted.

    #62588
    Franky
    Keymaster

    I guess you dit not correctly apply the changeset then 🙂

    #62589
    Anonymous
    Inactive

    Possible, but what there is to do? I downloaded the zip archive, renamed the existing eme_events.php in /wp-content/plugins/events-made-easy on the server and uploaded the one from the archive.

    I am using EME v2.1.122. If I open the existing eme_events.php I see that it is different from the one in the Changeset. The row numbers aren’t matching.

    #62590
    Franky
    Keymaster

    If you use the trac-link I gave, you need to apply the changes manually in it. Downloading the zip-archive and replacing a full file is in fact replacing your file with the one from development (which contains a lot more changes).
    I you don’t feel up to finding the matching rows (numbers will be different because a lot more changed in that file in other changes), then you need to wait until the next release.

    #62591
    Anonymous
    Inactive

    I wasn’t aware of that background.

    I replaced row by row and now it looks good. Awesome!

    #62592
    Franky
    Keymaster

    Good to hear! Does that mean the new placeholders work as intended too?

    #62593
    Anonymous
    Inactive

    I was waiting to confirm and it doesn’t look like. I use the following code:
    [eme_if tag='#ESC_NIGHTS_TILL_START' gt='1']Happens in #_NIGHTS_TILL_START days[/eme_if][eme_if tag='#ESC_NIGHTS_TILL_START' eq='1']Happens tomorrow[/eme_if][eme_if tag='#ESC_NIGHTS_TILL_START' eq='0']Happens today[/eme_if]

    And at the moment I have an event starting in less than 24 hours and it is shown as happening today and a second one on Sunday also announced as today.

    #62594
    Anonymous
    Inactive

    One more thing I discovered:

    I try to hide this info for normal user with the following code:
    [eme_if tag='#_IS_USER_IN_GROUP{admin}' value='1'][eme_if2 tag='#ESC_NIGHTS_TILL_START' gt='1']Happens in #_NIGHTS_TILL_START days[/eme_if2][eme_if2 tag='#ESC_NIGHTS_TILL_START' eq='1']Happens tomorrow[/eme_if2][eme_if2 tag='#ESC_NIGHTS_TILL_START' eq='0']Happens today[/eme_if2][/eme_if]

    I added me as a EME person and this person in a EME group called admin, but I can’t the the hidden part. It is also not shown for logged out users. If I set the value to 0 everybody can see it.

    #62596
    Franky
    Keymaster

    Ok, NIGHTS_TILL_START/END are fixed with this:
    https://plugins.trac.wordpress.org/changeset/2539048/events-made-easy/trunk

    For your admin-test: did you link your EME person to your wp account? Here your code works fine for that test

    #62599
    Anonymous
    Inactive

    I’m sorry. I replaced the two lines and now all events are happening today. #_NIGHTS_TILL_START/END are always 0. I checked again both changesets and verified that I replaced all the lines correctly.

    And for the is_user_in_group issue I also have more information:
    I had already linked the persons to their accounts, but I checked again. First I looked at the group again and noticed that the list of persons only contains small boxes with x (to delete), but no names or anything else to distinguish. I can delete and add the persons again. So I took a look at my person. (As it was a spontaneous idea and seemed a fast and easy way to hide the days-left-part I created the EME persons for the admin group only by giving them a firstname and the link to the wp account, nothing else.)
    The admin group is listed, but the linked WP account field is empty. I can select and update the profile, get a success message but when I open the profile again, the link is gone. The WP account profile is also very basic, also no surname. I guess when I fill in more and more data, the link will be possible, but I thought it might be helpful to remove this bug. There are no name collisions.

    #62600
    Franky
    Keymaster

    Maybe your WP account is already linked to another user, because EME refuses to link again then (but doesn’t say so in the updated message).
    Concerning your code changes: I tested my changes here and the outcome is as expected … copy/paste your current lines for #_NIGHTS_TILL_START here.

    #62602
    Anonymous
    Inactive

    Hmm, curious.

    I noticed the advice under the field to link but so far there are only WP admin users and the EME persons I created were the first EME persons. There is no chance that I can link any EME person with any of the WP accounts. Process ends always with a success message but without change.

    My NIGHTS-Code is still the same as above. If I just put #_NIGHTS_TILL_START somewhere to see the value, it is 0. #_DAYS_TILL_START is still giving a number. I checked the replaced lines again.

    I am confused.

    #62603
    Franky
    Keymaster

    With the code I meant the php code you changed. Concerning EME: you can add an extra column in the overview of persons to see their linked wp account.
    If in doubt, send me an admin account to check (together with the person you want to link etc …)

    #62604
    Anonymous
    Inactive

    The code starts in my eme_events.php in line 2558 and looks like this right now:

          } elseif ($event && preg_match('/#_DAYS_TILL_START$/', $result)) {
             $eme_date_obj = new ExpressiveDate($event['event_start'],$eme_timezone);
             $replacement = $eme_date_obj_now->getDifferenceInDays($eme_date_obj);
    
          } elseif ($event && preg_match('/#_NIGHTS_TILL_START$/', $result)) {
    	 $eme_date_obj = new ExpressiveDate($event['event_start'],$eme_timezone);
    	 $replacement = $eme_date_obj_now->getDifferenceInDays($eme_date_obj->endOfDay());
    
          } elseif ($event && preg_match('/#_DAYS_FROM_START$/', $result)) {
             $eme_date_obj = new ExpressiveDate($event['event_start'],$eme_timezone);
             $replacement = $eme_date_obj->getDifferenceInDays($eme_date_obj_now);
    
          } elseif ($event && preg_match('/#_DAYS_TILL_END$/', $result)) {
             $eme_date_obj = new ExpressiveDate($event['event_end'],$eme_timezone);
             $replacement = $eme_date_obj_now->getDifferenceInDays($eme_date_obj);
    
          } elseif ($event && preg_match('/#_NIGHTS_TILL_END$/', $result)) {
    	 $eme_date_obj = new ExpressiveDate($event['event_end'],$eme_timezone);
    	 $replacement = $eme_date_obj_now->getDifferenceInDays($eme_date_obj->endOfDay());
    
          } elseif ($event && preg_match('/#_HOURS_TILL_START$/', $result)) {
             $eme_date_obj = new ExpressiveDate($event['event_start'],$eme_timezone);
             $replacement = round($eme_date_obj_now->getDifferenceInHours($eme_date_obj));
    
          } elseif ($event && preg_match('/#_HOURS_FROM_START$/', $result)) {
             $eme_date_obj = new ExpressiveDate($event['event_start'],$eme_timezone);
             $replacement = round($eme_date_obj->getDifferenceInHours($eme_date_obj_now));
    
          } elseif ($event && preg_match('/#_HOURS_TILL_END$/', $result)) {
             $eme_date_obj = new ExpressiveDate($event['event_end'],$eme_timezone);
             $replacement = round($eme_date_obj_now->getDifferenceInHours($eme_date_obj));
    
          }

    The moment I copied it, I noticed that lines like $eme_date_obj = new ExpressiveDate($event['event_end'],$eme_timezone); have been like this in my file: $eme_date_obj = new ExpressiveDate($event['event_end_date']." ".$event['event_end_time'],$eme_timezone);

    I thought that was the explanation but even after changing I only see 0.

    Group issue:
    I added the extra column and none of the persons has a linked WP account. It doesn’t matter which of them I try. So I went further and added some more profile data. It seems that both, the person and the WP account, need to have a surname and an e-mail address and that these data have to be exactly the same. Then it works.

    #62605
    Franky
    Keymaster

    Humm … true … the changes I gave are indeed based on new code. For the old version that would not be working: $event['event_start'] doesn’t exist and should be replaced with $event['event_start_date']." ".$event['event_start_time']
    Concerning the group: once a person is linked to a WP account, that info (lastname, firstname, email) is copied over from the wp profile to eme. But of course you need to be logged in in WP and use that info (matching lastname/firstname/email) when you make a booking, so EME recognizes that (and in fact it should even recognize your logged in wp id). If not logged in, EME tries to find the combo lastname/firstname/email that matches at the moment of booking.
    Best would be to download the dev version and go from there 🙂

    #62606
    Anonymous
    Inactive

    That is not clear for me. How to go on? What means to download the dev version?

    Concerning Group: To make it clear again: It all happened without any booking. I created the persons in the dashboard and there was no data copying happening. It was the other way round. First I had to sync the three fields (lastname, firstname, email) manually then the system linked the profiles. I was logged in as admin, created a new person in the dashboard, only with my firstname, choose my WP account and saved. I got the success message, but the link wasn’t made. So I put in the same email address in my EME person profile as I have in my WP account profile and still got no linking. So I filled in a lastname for both profiles and then I could link them. Same for all the other persons I created that way. I had to verify that firstname, lastname and email address are the same to have a successful link.

    #62607
    Franky
    Keymaster

    in EME, when creating/editing a person, you can link that person to a WP account. If you don’t do that, how can EME know which person you want linked to a WP account. EME *always* requires the lastname and email (and I do mean always), and under certain conditions it knows which EME person to link to which WP account, but to be sure you need to make the link yourself.
    Concerning the dev version: I suggest you wait until the next released version (which is recommended if you don’t know php). If you do want to do it, download it at the bottom of this page: https://wordpress.org/plugins/events-made-easy/advanced/

    #62608
    Anonymous
    Inactive

    Hmm. I don’t know where and how we lost each other. There is some kind of misunderstanding. My point is: In the dashboard I created a EME person and used the dropdown field to link it to a WP account. I saved and received a success message, but the link wasn’t saved by the system. So for me this isn’t right, an error, a bug, because there was no successful update/saving of my settings. I found out that this link setting is only saved when EME an WP profile are equal in firtname, lastname and email address. What would be okay, but it is not indicated and not demanded by the success message. There is only one WP user with firstname Jan, and one EME person with firstname Jan. No links existed and no links could be made/saved. I added bit by bit some more information: same email address for my EME person as it is for my WP account. Still the link that I choose in the EME profile wasn’t saved. Finally I entered a lastname in my WP account and my EME person than the link was saved. At no point there was an advice that these data were needed to successfully save the link.

    And for the main subject: I am more than okay with having it in the next release. It wasn’t and isn’t that urgent. Thank you very much for adding it that fast.

    #62609
    Franky
    Keymaster

    Ok, *now* I got it 🙂
    There was indeed a weird section of code doing what you described, and this should fix it:
    https://plugins.trac.wordpress.org/changeset/2539718/
    (and that should work on your version of EME too)

    Edit: also the next version will return an error if the update fails for setting the wp id, and also exclude existing linked wp accounts from the possible list of users you can link with.

    #62612
    Anonymous
    Inactive

    Great news. I am glad that we resolved it 🙂

    As I already fixed it manually and have no need to link more profiles, I won’t use this changeset. But it is nice that this will be fixed.

    Merci beaucoup!

Viewing 26 posts - 1 through 26 (of 26 total)
  • The forum ‘How do I …’ is closed to new topics and replies.
Scroll to Top