Next Worship Service Rolling Over Too Early

ForumCategory: PluginsNext Worship Service Rolling Over Too Early
JimGasperini asked 4 months ago

In a thread started a month ago, it was noted that on each Sunday morning the UUA Services plugin premature displays the following week’s service as the upcoming service. See http://uuatheme.org/question/next-worship-service-rolling-over-too-early/
After some discussion, lp1948  posted a solution (pasted below) which involved a slight modification to three ,php files in the plugin. The thread was marked Closed.
Noticing the same problem on our site, I tried modifying the files according to lp1948’s solution. Alas, it caused our Featured Service widget and Upcoming Services page to display without any service content. 
Since it seems the thread was marked Closed prematurely, I have opened this new thread using the same title.
Lp1948 also said “Thankfully, the UUA team has been very responsive about getting fixes updated into the plugin.”
I am not sure what was meant here. There has been one update to the plugin since the theme update, but a fix for this problem was not included. Perhaps lp1948 is looking forward to a future plugin update that incorporates this fix? 
Lp1948’s solution:
[This bug is caused by the shortcode using the time() function for comparison. In WordPress, current_time(‘timestamp’) should be used. This can be fixed by replacing time() anywhere in the 3 relevant files, and replacing it, as such:

//$today = time();

$today = current_time('timestamp');

The 3 files where it should be replaced are:

  • featured-upcoming-service-widget.php
  • upcoming-services-shortcode.php
  • upcoming-services-widget.php]
3 Answers
dgranja answered 4 months ago

Jim, it was actually me that posted that workaround. You are correct – I had assumed the services plugin would be updated. Sadly, it hasn’t been beyond 1.0.2, which includes the bug. If I get motivated, I’ll see if I can contribute at the plugin page: https://github.com/UUA-WordPress/UUA-Services-Plugin.
Regardless, since you reported that yours displayed without any service content after making the change, it’s possible that you had no upcoming services entered, which would result in the empty content you described. I admit I made that mistake myself and it had me scratching my head. The other possibility is that you accidentally made an additional unintended change in one of the files, or maybe got a single character off or something. That could also result in a loss of functionality, but should show up in your error log. However, the workaround I described should indeed work. I guess I should add that folks should ensure the timezone is set properly in Dashboard > Settings > General.
As a convenience, I’ve included a link here to a zip file with my modified files, which are working on my site. It includes a readme.txt which will direct readers how to use the WordPress plugin file editor if they can’t access their server files directly. Be careful when modifying files! I’ll keep these files on my server until the end of the year (2018) or until the problem in plugin version 1.0.2 is fixed in an update.
Caveat emptor!  https://palouseuu.org/ModifiedUUA-ServicesPHPFiles-180218.zip

JimGasperini replied 4 months ago

Thanks, dgranja, and apologies for misattributing the workaround.

I’m not sure what was wrong about the first time I tried to use it. I did have several upcoming services queued up, I never use the WordPress plugin editor, and am generally very careful about not adding extraneious characters to code.

Whatever went wrong then, the fix works now, both in the home page feature and the Upcoming Services page.
Thanks again.

dgranja replied 4 months ago

Sweet, Version 1.0.3 of the Services plugin was released today and fixed this issue. I will be removing the above-mentioned ModifiedUUA-ServicesPHPFiles-180218.zip file. Update to the latest plugin version!
I like Margy Levine Young.

cplewis4 replied 3 months ago

I’m still seeing problems with the rolling. If I put the service date 1 or 2 minutes from now, then update the service, I see that service listed on the home page. But then after 2 minutes – or even 5 minutes, I don’t see the next service. It seems like it’s not rolling when it’s supposed to now.

JimGasperini replied 3 months ago

Hello cplewis4–
Are you experiencing this with the newly updated plugin version 1.0.3?

cplewis4 replied 3 months ago

Hi Jim, Yes, I’ve upgraded to the newest version (1.0.3).

Margy Levine Young Staff answered 4 months ago

A fix is also in the works for the next theme bug-fix update.

Margy Levine Young Staff answered 4 months ago

Version 1.0.3 of the Services plugin was released today and fixed this issue.