WordPress.org

Support

Support » Plugins and Hacks » Hacks » Creating expiring download links?

Creating expiring download links?

  • Hello,
    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.

    Regards

Viewing 1 replies (of 1 total)
  • 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 🙂

Viewing 1 replies (of 1 total)
  • The topic ‘Creating expiring download links?’ is closed to new replies.