Sermon Download Does Not Download But Only Plays

Issue #46 resolved
Gee Hill created an issue

The download link only plays the sermon and does not download. I do not want for people to have to figure out to right click the link to "save as". Is there a fix for this as it is not a "download" link but a "play" link below the audio player which is redundant and not intuitive but confusing. I have many people tell me that the "download" link "does not work".

Can you help me?

Comments (8)

  1. Rocky Swartz

    Let me start by saying that I am a complete novice. I have only this one website under my belt. Quite a steep learning curve.

    I took this up this issue with Allen a couple of weeks ago. I came across some code creating a new php that sits in the same folder as the MP3's (http://youngdigitalgroup.com.au/tutorial-force-download-mp3-file-streaming/) Direct_download.php

    <?php $file = $_GET['file']; header ("Content-type: octet/stream"); header ("Content-disposition: attachment; filename=".$file.";"); header ("Content-Length: ".filesize($file)); readfile($file); exit; ?>

    This works fine when writing my own post, however, I have a problem when changing the theme function.php from: if ( edwards_get_meta('sermon_audio') ) { echo '<li class="download"><a href="' . edwards_get_meta('sermon_audio') . '" class="sermon-button"><i class="icon-download"></i><span> Download MP3</span></a></li>'; } To if ( edwards_get_meta('sermon_audio') ) { echo '<li class="download"><a href="../wp-content/uploads/sermons/direct_download.php?file=I need the filename here '" class="sermon-button"><i class="icon-download"></i><span> Download MP3</span></a></li>'; }

    The result I get is: http://www.swbc.co.za/sermons/an-empty-tomb-2/.../wp-content/uploads/sermons/direct_download.php?file=http://../wp-content/uploads/sermons 2015_04_05_sermon_348.mp3 instead of http://www.swbc.co.za/../wp-content/uploads/sermons/direct_download.php?file=http://../wp-content/uploads/sermons /2015_04_05_sermon_348.mp3

    If I change the address bar to the latter, it takes me to the save file dialog box.

    Looking forward to hearing from the developers

  2. John Millist

    Try in 'template-tags', changing the wpfc_sermon_single function...

    Add... download="'.wp_get_attachment_url($attachment->ID).'">

    This will create a forced download. Although upon updating sermon manager this will be lost.

    Can this not be added to the core?

  3. Rocky Swartz

    As mentioned I am still a novice with php

    I have looked at the template-tags.php file - function wpfc_sermon_single()

    Where do I place the download="'.wp_get_attachment_url($attachment->ID).'">. I keep getting a php load error

    Is there any news from the developers on John's question to add this to the core function php

  4. Rocky Swartz

    That is great news. Thank you! When you say resolved in 2.0 I assume you mean there is an updated version. The WPforChurch website still has Sermon Manager 1.9 as its latest. Am I missing something?

  5. Rocky Swartz

    Hi James

    I see the new version is out. I upgraded, but somehow it broke my sermons page layout.

    I have compared the previous version with the latest and WOW, it is a complete re-vamp, so not sure where to start.

    I have reverted back to the old version, which is a pity.

    I you can look at www.swbc.co.za http://www.swbc.co.za . Under meu item “Resources” you will find “Sermon Archive”. Is it possible to maintain this look with the new version.

    I am running a Child Theme under the Edwards theme and all of the sermon manager CSS has been transferred to style.css

    By the way, not sure where to post new issue items. Can’t find it on the wpchurch website.

    Thanks

    Rocky Swartz

  6. Log in to comment