CodeCanyon
CodeCanyon
Code
Code
Code
Code
Code
Code

User Downloads

User Downloads

Features

  • Restrict files to specific user
  • Now with expiration date!
  • List files assigned to specific user
  • All files-URL are encrypted.
  • 100% safe restricted files

Todo

  • Add counter to downloads and restriction on how many times it can be downloaded.
  • Create more settings like, what if file is expired.

Usage

  • Upload the plugin
  • Enable the plugin.
  • In the WordPress menu you now will see “User Downloads” added. If you go to “User Downloads” => “Settings” you can set your encryption keys.
  • Than you can create User Downloads wich goes as follows:
    • Create a User Download.
    • Enter a title
    • Enter some content
    • Select to wich user the to be uploaded files should be restricted
    • Upload files for this specific user
    • Publish the User Download
  • I created a function to get all files that are belongs to the logged in user. The functions is get_user_specific_downloads_as_array. With this you can do anything you want to. Let me give you an example of how to list all files of one user per User Download (per post):
  •         
        $files = '';
        $userFiles = get_user_specific_downloads_as_array();
        foreach($userFiles as $userdownload)
        {
            $files .= '<h2>'.$userdownload['title'].'</h2>';
            $files .= $userdownload['content'];
            $files .= '<ul>';
            foreach($userdownload['files'] as $file)
            {
                $files .= '<li>';                
                $url = explode('/',$file['user_download_file']['url']);
                $encryptedurl = user_specific_downloads_encrypt_decrypt('encrypt',$url[8]);
                $encryptedurl = rawurlencode($encryptedurl);
                if(strtotime($file['file_expiration_user_download_file']) < time() && strtotime($file['file_expiration_user_download_file']) != '')
                {
                    $files .= '<a href="#" onClick="alert(\'This file as expired.\'); return false;">'.$file['user_download_file']['title'].'</a><br />';
                }
                else
                {
                    $files .= '<a href="'.plugins_url().'/user-downloads/download.php?file='.$encryptedurl.'">'.$file['user_download_file']['title'].'</a><br />';
                }
                $files .= '<em>'.$file['file']['description'].'</em>';                
                $files .= '</li>';
            }
            $files .= '</ul>';        
        }
        echo $files;
    
  • If you have any questions (technical or not) I will be able to help you.

Changelog

  • 29-08-2017
    Checked support for WP 4.8
25-10-2016
  • Checked support for WP 4.6.1

20-1-2015

  • Added support for translations (multilanguage).

29-7-2014

  • Added ability to select multiple users.

10-7-2014

  • Fixed bug when not setting the expire date.
2-6-2014
  • Improved encryption of files.
3-3-2014
  • Added shortcode.
25-2-2014
  • Added expiration date for downloads.
  • Fixed bug in settings panel.
  • Added support for subdomains.
  • Added support for Windows Servers.

26-12-2013

by
by
by
by
by
by