Forum Replies Created

Viewing 15 replies - 1 through 15 (of 47 total)
  • Thread Starter mickna

    (@mickna)

    I’ll open a new thread ??

    Thread Starter mickna

    (@mickna)

    Hello James,

    I just play around and I have one more point:

    it seams, the document is saved with its original file name – great ?? But the link, which is generated for “Latest Version of the Document Download” is set to the post title. I am confused:

    If I download the file, it has also the post title as name. However, on the server, the document has its original name. how can I prevent this? My client just wants to preserve his document name also for downloading.

    Thank you,

    Michael

    Thread Starter mickna

    (@mickna)

    @nwjames :

    First of all: I am blown away from your efforts to help me. Never ever get this kind of detailed, skillful and patient answer / support.

    “Separately you can look in your file uploads directory” – Yes! I was too lazy and only looked at the downloadlink itself. *shame on me*

    The File is stored with its original name! Bahm!

    The file is downloaded with the name of the posting. This is something I have to fix now. So: Upload is perfect. Download I have to look by myself. I am sure I can handle this, as I believe there is also a WP filter.

    Again: Thank you so much Neil. I really, really appreciate your help and I am so thankful ??

    Michael

    Thread Starter mickna

    (@mickna)

    But Neil,

    there is no mu-plugins directory wp-content/mu-plugins

    Also I can not find a mu-plugins under wp-content/plugins/wp-document-revisions

    If I create a directory wp-content/mu-plugins and place the file there (of course with <?php nothing happens.

    What I did for testing was a copy&paste to function.php (better: as a snippet with snippet plugin)

    I feel stupid :/

    Thread Starter mickna

    (@mickna)

    @nwjames:

    I really, really appreciate your support!

    To check, if I came across function 2 I did:

    add_filter( 'wp_handle_upload_prefilter', 'filename_capture', 1 );
    
    if ( ! function_exists('filename_capture') ) {
    /**
    * Save uploaded file name.
    *
    * @since 0.5
    * @param array $file file data from WP.
    * @return array $file file with new filename
    */
    function filename_capture( $file ) {
    global $wpdr_filename;
    $wpdr_filename = $file['name'];
    $file['name'] = "funct01";
    return $file;
    }
    } add_filter( 'document_internal_filename', 'revert_filename' ); if ( ! function_exists('revert_filename') ) {
    /**
    * Filters the encoded file name for the attached document (on save).
    *
    * @param array $file encoded file name.
    */
    function revert_filename( $file ) {
    global $wpdr_filename;
    $file['name'] = $wpdr_filename;
    $file['name'] = "funct02";
    return $file;
    }
    }

    As I did not specify a suffix, WP outputs:

    “funct02” has failed to upload.
    Sorry, you are not allowed to upload this file type.

    Great! This means I came across fct. 2 = revert_filename.

    If I use a suffix to test further $file[‘name’] = “funct02.pdf”;

    I came back to the upload screen and guess what? The file has the name of the posting and not “funct02.pdf”. Wired….

    So we set a new $file[‘name’] but it seams to be ignored. Sure the hook / filter “document_internal_filename” is the right one at this time?

    Thread Starter mickna

    (@mickna)

    Woops. I am sorry….

    I can’t see a directory called wp-content/mu-plugins

    If I create one and place the php code, nothing has changed. The file is renamed to post name.

    If I insert the code as a snipped the filter seams to work, but I get

    “” has failed to upload.
    Sorry, you are not allowed to upload this file type.

    For a PDF, which I can upload without these filters.

    Any ideas?

    Thank you,

    Michael

    • This reply was modified 1 year, 11 months ago by mickna.
    Thread Starter mickna

    (@mickna)

    @nwjames:

    I really appreciate your thoughts and more over your fantastic support and help.

    I am aware of your concerns and if we would have a normal WP I completely agree.

    In our case, we have an Intranet with no connection to the Internet. Also all documents are PDFs and all employs can download all documents. Therefore we do not have any restriction.

    Also every document has a really special naming and it will cost more time to name the custom post like the document name, as just upload this document.

    Again thank you for your thoughts, great support and (for me) a live saving plugin ??

    Michael

    • This reply was modified 1 year, 11 months ago by mickna.

    Ok. In my case it is WP6.2 and a older Pro (theme.co) Theme.

    First update Theme, than WP.

    I get “Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 8192 bytes) in /www/htdocs/***/wp-includes/script-loader.php on line 1029”

    Thread Starter mickna

    (@mickna)

    Hi Neil,

    sorry for my late replay.

    Thank you ??

    Thread Starter mickna

    (@mickna)

    Interesting ….

    The Author will be send to the Backend (wp-admin) as author.

    Ok, please let me check first a few things. We have some code snippets and other plugins running. I believe it make sense first to check on my side. I’ll drop you a line here after checking ??

    Best,

    mickna

    Thread Starter mickna

    (@mickna)

    Hi @hjogiupdraftplus,

    thank you.

    No it is not enabled. It is disabled.

    Best,

    Mickna

    Thread Starter mickna

    (@mickna)

    Thank you Shea ??

    Thread Starter mickna

    (@mickna)

    Digging a little bit further I become as Cookies:

    PHPSESSID (Session)
    -elfinder-lastdirfile_manager_advanced (Persistent)
    -elfinder-toolbarhidesfile_manager_advanced (Persistent)

    Can I avoid this cookies to be set before a user is accepting cookies?

    Thank you,
    Michael

    Thread Starter mickna

    (@mickna)

    @ninjo
    We dug a little bit deeper through the code.
    If I remember, there are two or three points in the code, where you should modify the lines.
    I can take look next week, where we did the mods if you are interested. However, this would be a fork and any updates will rewrite these lines.

Viewing 15 replies - 1 through 15 (of 47 total)