The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Creating expiring download links? (2 posts)

  1. Haloscope
    Posted 5 years ago #

    I'm working on a plugin that would benefit from a system that allows WordPress to create temporary links to downloads that would expire after a short time. I couldn't find any plugins on point, so I'll be writing one. However, I would prefer not to reinvent the wheel.
    I figure it would incorporate a few different elements:

    1. Create redirecting link to the real download location
    2. Destroy that redirecting link to the real download location after a user specified time

    Have you done either of these things? How would you suggest doing so?
    I would appreciate any assistance you may have or directions you could point me in.


  2. digibucc
    Posted 5 years ago #

    i would start with this:

    Google URL shortener API

    have that create the link.

    for the expiration, it's not something i have ever done. my first thought would be a table in your db, that gets an entry every time a link is created, with a time. then a cron script could run every hour and delete entries older than "x" time.

    it may be possible to have a script that checks the db before opening the link. if it's a file on your site, you could probably edit htaccess to run a script that checks the url and when it was created before allowing a download. idk that either, but it sounds good :)

Topic Closed

This topic has been closed to new replies.

About this Topic