Consumer Downloads (Utilities)

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):
  •       $userFiles = get_user_specific_downloads_as_array();
          foreach($userFiles as $userdownload)
          
              echo '<h2>'.$userdownload['title'].'</h2>';
              echo $userdownload['content'];
              echo '<ul>';
              foreach($userdownload['files'] as $file)
              
                  echo '<li>';
    
                  $url = explode('/',$file['user_download_file']['url']);
                  $encryptedurl = user_specific_downloads_encrypt_decrypt('encrypt',$url[8]);
                  $encryptedurl = rawurlencode($encryptedurl);
    
                  echo .= '<a href="'.plugins_url().'/user-downloads/download.php?file='.$encryptedurl.'">'.$file['user_download_file']['title'].'</a><br />';
                  echo .= '<em>'.$file['file']['description'].'</em>';
    
                  echo '</li>';
              
              echo '</ul>';
    
          
  • If you have any questions (technical or not) I will be able to help you.

Leave a Reply

Your email address will not be published. Required fields are marked *