WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Display Views/Downloads Publicly On Post? (4 posts)

  1. bdp
    Member
    Posted 1 year ago #

    I know this has been asked a lot but I really couldn't find anything that was up to date and suited my needs. And there's really no plugins out there that will get the job done.

    But anyways I want to display the views on my page so the public could see it. Also, I want to show the number of downloads for .zip files and .mp3 files.

    A good example is at http://www.datpiff.com/Lil-Wayne-Dedication-4-mixtape.385544.html

    Here is my page I want to achieve this on: Los - The Crown Ain't Safe

    On my King Los fansite, I'm running the latest WordPress version and I'm using the Jetpack stats if that helps.

    Please someone help!!! I had almost 500 songs (free & had permission from owner) on Sharebeast (Premium Account), but Sharebeast deleted pretty much all of them with no explanation and won't answer me now. So now I just uploaded all the songs to my File Manager on iPage. And I am using the code:

    <FilesMatch "\.(?i:mp3)$">
    ForceType application/octet-stream
    Header set Content-Disposition attachment
    </FilesMatch>

    in my .htaccess so people can direct download straight from my site. Only thing is I don't have a download counter now.

    Sorry for rambling but is there anyone out there that can provide me a solution???

  2. bcworkz
    Member
    Posted 1 year ago #

    If you have php skills, you could build your own counter and implement it as a plugin. You'll need a table in the DB to store the counts, it can be in the WP DB, but it's own table. Then you can use $wpdb methods to access it.

    You would essentially use .htaccess to route all download traffic through a counter page, the actual download filename passed as an url parameter. You would also use .htaccess to block direct downloads by only allowing access if the referer is the counter page. Thus, the only way to get the file is to go through the counter page. In theory, someone could forge a fake request with the counter page listed as referer, even though it wasn't actually used. I don't think anyone would bother, but you could add security with cookies and nonces if it became an issue.

  3. bdp
    Member
    Posted 1 year ago #

    That sounds pretty confusing. I was looking for something more simple. Like just implementing some js/jquery into the page to show the downloads of a specific file. And I really didn't want to have to change the URL's to enable a counter.

    Any other ideas? Do you know what's used for the WordPress Download Counter?

  4. bcworkz
    Member
    Posted 1 year ago #

    You wouldn't have to change the urls, it would be redirected by .htaccess. But it's definitely not simple. The WP counter appears to use Google Analytics. I don't use it myself, but it probably could meet your needs, it's worth looking into IMO.

Topic Closed

This topic has been closed to new replies.

About this Topic