Support » Plugin: Lana Downloads Manager » Download Headers Problem

  • Resolved aurepons

    (@aurepons)


    Hi, my problem is that all downloads are forced to be attachments, where I need inline downloads to open PDF directly in browser.

    You force it including the download http headers by code:

    header( 'Content-Type: application/octet-stream' );
    header( 'Content-Disposition: attachment; filename=' . $filename );

    Is it possible for you to add a do_action hook beetwen header commands and readfile command? So I could change headers as I need. Something like this:

    do_action( 'lana_downloads_manager_after_download_http_headers', $download_id );

    Thank you very much

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Lana Codes

    (@lanacodes)

    Yeah, this has been a topic here on the forum several times.

    Please read this: https://wordpress.org/support/topic/open-pdf-in-new-window-not-download/

    But otherwise there is an action hook:
    do_action( 'lana_downloads_manager_before_file_download', $download_id );

    You check that the file is a PDF and if so, you open it.

    You need to add the header() functions again, but I think it will work. It is not customary to add hooks to all rows, we only add them at the beginning of the process, and completely redefine individual operation.

    Let me know if I can help anyone else.

    aurepons

    (@aurepons)

    Thank you very much, I have solved it as you indicate

    • This reply was modified 6 months ago by aurepons.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Download Headers Problem’ is closed to new replies.