Forum

This forum is now read-only. Support is provided at https://wordpress.org/support/plugin/sermon-browser/

Please consider registering
guest
sp_LogInOut Log Insp_Registration Register
Register | Lost password?
Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Feed Topic RSSsp_TopicIcon
Bug fix: Sermon page not recognized for new installs
30 May, 2013
6:14 pm
Ben Miller
Appleton, WI, USA
Moderator
Members

Moderators
Forum Posts: 1628
Member Since:
18 June, 2009
sp_UserOfflineSmall Offline

In the course of some testing, I ran into a problem.  I had just installed WordPress and Sermon Browser on a test site.  I created my Sermons page containing the "sermons" shortcode, but Sermon Browser was not finding it.  I was still getting the warning about creating the Sermons page, and the Private podcast feed listed under Sermons, Options, was not showing the correct path to the Sermons page.

Here is what I figured out: The query string to look for the page containing the "sermons" shortcode checks to see that any page it finds is published in the past, and not scheduled for future publication.  The idea, I guess, is that if a page is set to publish in the future, we shouldn't use it, because the page is not public.  However, we do allow "private" posts in the query string, probably so that an admin can work on the Sermons page and test out Sermon Browser without making it public until it is ready.

When the query string checks that the page is in the past, it uses the post_date from the page and compares it with the current time using the NOW() SQL function.  The problem is that the post_date is based on the timezone that the user has selected in the WordPress General settings (defaults to GMT).  The NOW() SQL function uses whatever timezone the SQL server happens to be set to.  In the case of my test site, the SQL server was set to Pacific (California) time.  So the query thought that the new Sermon page I created was scheduled to publish in 7 or 8 hours, even though it was already visible on the site.

This might be the reason that we've seen users on the forum complain that Sermon Browser isn't working, and then it magically starts working later.

Anyway, long story short, here is the change.  I don't really see a need to check the publish time on the Sermon page, so I'm removing the check.  I will try to get this into a future version of Sermon Browser, but if you are reading this, you probably don't need to patch your own site; it only affects you if you are creating your Sermons page for the first time.

sermon.php, function sb_get_page_id:

OLD code:

http://pastebin.com/EpGAdkqa

NEW code:

http://pastebin.com/EjZNkVgD

Let me know if you have any questions or comments about this change.

Ben Miller, Pathways Church, Appleton, Wisconsin, USA
Read the new FAQ, last updated 11/21/2013
Announcing version 0.45.12

Forum Timezone: Europe/London
Most Users Ever Online: 381
Currently Online:
Guest(s) 8
Top Posters:
Rich Brown: 358
Matt Schlueter: 93
Mindy: 72
Don Johnson: 65
anointed: 57
0be1: 55
Member Stats:
Guest Posters: 7
Members: 3188
Moderators: 1
Admins: 1
Forum Stats:
Groups: 1
Forums: 2
Topics: 1713
Posts: 7499
Newest Members:
marktest, deatles50, ValeriaGoodriz, dapedPup, oapedPup, Margarettoimb
Moderators: Ben Miller: 1628
Administrators: Mark Barnes: 435