• [ Moderator note: moved to Fixing WordPress. ]

    Hi everyone,

    I use a perfect simple audio plugin named PlayPress on my website.

    I’d like to remove the download link which appears on every file.

    I don’t know the first think about coding but I guess this is the code of the plugin, could anyone tell me what to change to remove the download links?

    Plugin has been discontinued for years so I’m not posting in its specific support forum, thanks for your understanding.

    Thanks in advance for your help!

    <?php
    /*
    Plugin name: PlayPress
    Plugin URI: https://joshuagoodwin.com/playpress
    Version: 1.2.1
    Description: A JavaScript-free, non--Flash-dependent audio player, fortified with HTML5 vitamins and minerals. [audio mp3="example"]
    Author: Joshua Goodwin
    Author URI: https://joshuagoodwin.com
    License: MIT
    */
    function playpress_func($atts)
    {
        extract(
            shortcode_atts(
                array('mp3'=>'', 'ogg'=>'', 'title'=>false, 'artist'=>false), $atts
            )
        );
    
        STATIC $i = 0;
        $i++;
    
        $flash_parameters = 'soundFile=' . $mp3 . '&playerID=' . $i;
        if ($title === '' || $artist === '') {
            $flash_parameters .= '&noinfo=yes';
        }
        if ($title !== false) {
            $flash_parameters .= '&titles=' . $title;
        }
        if ($artist !== false) {
            $flash_parameters .= '&artists=' . $artist;
        }
    
    /*
    You can customise the Flash player like this:
    
        $flash_parameters .= '&setting=value&setting=value';
    
    Some popular settings and their default values (see https://wpaudioplayer.com/standalone/ for more):
    
        autostart=no
        loop=no
        animation=yes
        remaining=yes
        noinfo=no
        initialvolume=60
        buffer=5
        checkpolicy=no
        rtl=no
    
        bg=E5E5E5
        leftbg=CCCCCC
        lefticon=333333
        voltrack=F2F2F2
        volslider=666666
        rightbg=B4B4B4
        rightbghover=999999
        righticon=333333
        righticonhover=FFFFFF
        loader=5386B0
        track=FFFFFF
        tracker=DDDDDD
        border=CCCCCC
        skip=666666
        text=333333
    */
    
        $flash_top = '<object id="audioplayer' . $i . '" type="application/x-shockwave-flash" data="' . plugins_url() . '/playpress/player.swf" width="700" height="27">
    <param name="movie" value="' . plugins_url() . '/playpress/player.swf" />
    <param name="FlashVars" value="' . htmlspecialchars($flash_parameters) . '" />
    <param name="quality" value="high" />
    <param name="menu" value="false" />
    <param name="wmode" value="opaque" />';
    
        $download_link = '<a href="' . $mp3 . '">Download audio file (' . basename($mp3) . ')</a>';
    
        if (! is_feed()) {
            if (! empty($mp3)) {
                $output = '<p>';
                if (! empty($ogg)) {
                    $output .= '<audio controls preload="metadata">';
                    $output .= '<source src="' . $mp3 . '" type="audio/mp3"><source src="' . $ogg . '" type="audio/ogg" />';
                }
                $output .= $flash_top;
                if (empty($ogg)) {
                    $output .= '<audio controls preload="metadata" src="' . $mp3 . '">';
                }
                $output .= $download_link;
                if (empty($ogg)) {
                    $output .= '</audio>';
                }
                $output .= '</object>';
                if (! empty($ogg)) {
                    $output .= '</audio>';
                }
                $output .= '</p>';
        } elseif (! empty($ogg)) {
                $mp3 = $ogg;
                $output = '<p>' . $download_link . '</p>';
            }
        } else {
            if (! empty($mp3)) {
                $output = '<p>' . $download_link . '</p>';
            }
            if (! empty($ogg)) {
                $mp3 = $ogg;
                $output .= '<p>' . $download_link . '</p>';
            }
        }
        return $output;
    }
    add_shortcode('audio', 'playpress_func');
    ?>
Viewing 9 replies - 1 through 9 (of 9 total)
  • @minimat, Could you replace the full-code with the following one and comment whether it works for you or not?

    <?php
    /*
    Plugin name: PlayPress
    Plugin URI: https://joshuagoodwin.com/playpress
    Version: 1.2.1
    Description: A JavaScript-free, non--Flash-dependent audio player, fortified with HTML5 vitamins and minerals. [audio mp3="example"]
    Author: Joshua Goodwin
    Author URI: https://joshuagoodwin.com
    License: MIT
    */
    function playpress_func($atts)
    {
        extract(
            shortcode_atts(
                array('mp3'=>'', 'ogg'=>'', 'title'=>false, 'artist'=>false), $atts
            )
        );
    
        STATIC $i = 0;
        $i++;
    
        $flash_parameters = 'soundFile=' . $mp3 . '&playerID=' . $i;
        if ($title === '' || $artist === '') {
            $flash_parameters .= '&noinfo=yes';
        }
        if ($title !== false) {
            $flash_parameters .= '&titles=' . $title;
        }
        if ($artist !== false) {
            $flash_parameters .= '&artists=' . $artist;
        }
    
    /*
    You can customise the Flash player like this:
    
        $flash_parameters .= '&setting=value&setting=value';
    
    Some popular settings and their default values (see https://wpaudioplayer.com/standalone/ for more):
    
        autostart=no
        loop=no
        animation=yes
        remaining=yes
        noinfo=no
        initialvolume=60
        buffer=5
        checkpolicy=no
        rtl=no
    
        bg=E5E5E5
        leftbg=CCCCCC
        lefticon=333333
        voltrack=F2F2F2
        volslider=666666
        rightbg=B4B4B4
        rightbghover=999999
        righticon=333333
        righticonhover=FFFFFF
        loader=5386B0
        track=FFFFFF
        tracker=DDDDDD
        border=CCCCCC
        skip=666666
        text=333333
    */
    
        $flash_top = '<object id="audioplayer' . $i . '" type="application/x-shockwave-flash" data="' . plugins_url() . '/playpress/player.swf" width="700" height="27">
    <param name="movie" value="' . plugins_url() . '/playpress/player.swf" />
    <param name="FlashVars" value="' . htmlspecialchars($flash_parameters) . '" />
    <param name="quality" value="high" />
    <param name="menu" value="false" />
    <param name="wmode" value="opaque" />';
    
        $download_link = '';
    
        if (! is_feed()) {
            if (! empty($mp3)) {
                $output = '<p>';
                if (! empty($ogg)) {
                    $output .= '<audio controls preload="metadata">';
                    $output .= '<source src="' . $mp3 . '" type="audio/mp3"><source src="' . $ogg . '" type="audio/ogg" />';
                }
                $output .= $flash_top;
                if (empty($ogg)) {
                    $output .= '<audio controls preload="metadata" src="' . $mp3 . '">';
                }
                $output .= $download_link;
                if (empty($ogg)) {
                    $output .= '</audio>';
                }
                $output .= '</object>';
                if (! empty($ogg)) {
                    $output .= '</audio>';
                }
                $output .= '</p>';
        } elseif (! empty($ogg)) {
                $mp3 = $ogg;
                $output = '<p>' . $download_link . '</p>';
            }
        } else {
            if (! empty($mp3)) {
                $output = '<p>' . $download_link . '</p>';
            }
            if (! empty($ogg)) {
                $mp3 = $ogg;
                $output .= '<p>' . $download_link . '</p>';
            }
        }
        return $output;
    }
    add_shortcode('audio', 'playpress_func');
    ?>
    Thread Starter minimat

    (@minimat)

    Thanks for your answer, but it doesn’t work (button is still here, and the download works).

    Please share your site url to replicate the issue.

    Thread Starter minimat

    (@minimat)

    I don’t see any ‘Download’ button. Please provide more info. including specific URL.

    Thread Starter minimat

    (@minimat)

    The button appears on Google Chrome if I’m correct.

    If I go to https://www.minimat.fr/mixes-2, I don’t see any download button. Here is a screenshot:

    No Download Button

    Thread Starter minimat

    (@minimat)

    These are mixclouds links. The mp3 are on all the pages under “La Techno Minimale”, which are password protected. The download link will only appear on Chrome.

    – I can’t troubleshoot further if the page is Password Protected.
    – As you said, if ‘Download Link’ appears only in the Chrome, then the issue looks browser specific, not WordPress specific. Disable all the Chrome extensions and retry.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Remove download link from audio player’ is closed to new replies.