• Resolved garrettm30

    (@garrettm30)


    How do you feel about requests for hooks? I think I could use one to try to gracefully handle old download links from our previous plugin that did not require hashes.

    We have sent out a number of download links in things like email newsletters over the years. Some of them were intended to be able to be reused for future reference. I would like to find a better way to treat our visitors who might click those links than serve them a wp_die() message for clicking a link we ourselves sent them.

    If it is no trouble, I would like to get some kind of hook where I could handle those old cases. I have done some experimenting, and here is an example hook would allows some flexibility:

    $hash_key = apply_filters('simple_download_counter_download_hash', $hash_key, $id, $hash);

    That would go right after $hash_key is defined in inc/functions-core.php, line 282. Then we could do things like these (I have tested both options):

    • Allow old links sent before we used hashes to still work by returning the expected hash if the $id is in the range of the known old downloads and a key url parameter is not set.
    • Send the user to the 404 page where the option to search is offered.

    If a person wanted to disable requiring hashes entirely, it could also work for that.

    Totally unrelated: I just realized you are the person responsible for the 7G Firewall rules that I have been running on our sites for the last few years. Now I am doubly grateful, and you have my respect.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Jeff Starr

    (@specialk)

    This is definitely do-able. I will add the described hook in the next update. Thank you again for your detailed, thorough feedback. It is very much appreciated.

    Plugin Author Jeff Starr

    (@specialk)

    Just to follow up with this, the filter hook is added in the next version (1.8) of Simple Download Counter. Should be available later today or tomorrow. Thank you, @garrettm30.

    Thread Starter garrettm30

    (@garrettm30)

    I’m sorry for the delay, as I am only now coming back to this. I had customized my copy of your plugin in advance of your update while I turned my attention to other things, and I have only now tested and updated my live site with your 1.8. Now I simply wish to return to express my gratitude.

    Plugin Author Jeff Starr

    (@specialk)

    You are very welcome, @garrettm30. And thank YOU for the great review, very much appreciated. Cheers.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Request a hook for downloads without hash’ is closed to new replies.