Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #6276
    ike
    Participant

    Hey,

    My post seems to have disappeared, not sure if you got a chance to read my reply – was there a way to add this filter? (not for hiding display, but for blocking access to URL if user not logged in)

    Thanks

    #6277
    Bartosz
    Keymaster

    Sorry @ike,

    We switched to a new server during the weekend, your post (and my answer) must have been removed.

    I’m adding a new filter for you, includes/functions.php line 435 was:

    $filepath = $uploads['basedir'].'/'.$attachment;

    will be:

    $filepath = $uploads['basedir'].'/'.$attachment;
    $filepath = apply_filters('da_download_attachment_filepath', $filepath, $attachment_id);

    You have filepath and attachment ID, you can apply any conditional statements here. Use it – it will be there after plugin update.

    But you can also filter file visibility in da_get_download_attachments() and da_display_download_attachments() functions – there are filters avaiable already. The one we talk about above is for direct download – when someone knows the url or tries to get download url to process file download. It’s not responsible for links display.

    #6290
    ike
    Participant

    Thank you Bartosz, works perfectly! And thanks for including it in the next update.

    Great support :)

    #19021
    deadhead1971
    Participant

    Hello, I think this is exactly what I need, since I will only be using this plugin for files that should only be downloaded by logged in users.

    How do you implement these filters please?

    Can you please give an example of the conditional code and where to place it within these functions?

    I’m OK editing files, I just need help with the syntax etc so I’m hoping you can share some example code.

    Many thanks
    Alan

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.