Forum

You must be logged in to post Login Register

Search Forums:


 






Enhancement: Sermons with Unknown Date

No Status Selected
UserPost

4:19 pm
13 April, 2009


cybersheep100

Enthusiast

posts 13

I have a lot of sermon mp3 files where I don't know the date they were preached.

If I leave date field on the Add New Sermon Page blank, sermon-browser (because of a PHP function line 1626 of sermon.php and the need to store dates in an SQL DATE format) converts this to '1970-01-01'.

I have tweaked the files to display "Unknown" if the date is stored as '1970-01-01' which for most of my files is correct. The only downside is if you actually had a file of a sermon preached on that one day (probably less likely than having sermons with unknown dates) – it would display as 'Unknown' Date!


Here are the tweaks:

sermon.php line 1563 change from:

<td><?php echo $sermon->date  ?></td>

to:

<td><?php if ($sermon->date='1970-01-01') {echo 'Unknown';} else {echo $sermon->date;}  ?></td>


frontend.php [function sb_formatted_date] change end line (480) from:

return date_i18n(get_option("date_format"), strtotime($sermon->date.' '.$sermon_time));

to:

if ($sermon->date='1970-01-01') {return 'Unknown Date';} else {
    return date_i18n(get_option("date_format"), strtotime($sermon->date.' '.$sermon_time));
    }


That's it! Hope that helps someone else!

10:54 am
17 April, 2009


Mark Barnes

Admin

posts 321

Post edited 10:02 am – 17 April, 2009 by Mark Barnes


Thanks! I've added these fixes to 0.42.3. There's a minor bug in your code, so I recommend everyone else wait for the new version rather than apply the fix themselves. (It should be == not just = ).


About the 4:14 evangelical christian theology blog forum

Most Users Ever Online:

19


Forum Stats:

Groups: 1

Forums: 6

Topics: 544

Posts: 2106




Popularity: 37% [?]