CM Download (CMDM) - Advanced - Creating New Downloads From Uploaded Files
Creating New Downloads From Uploaded Files (Advanced)
What is This Feature
You can make it so that every file uploaded in WordPress becomes a download managed by Download Manager.
This process is intended for developers.
This feature requires you to develop a file upload function. All that's necessary is to pass the file name to the hook.
$new_download = apply_filters('cmdm_custom_file_to_download', $new_download, $file_data); where $new_download - url to or ID of new created download item $file_data - array of file data to be processed by CMDM plugin, its structure: $file_data = array( 'file_path' => 'path to origin file including file name and extension', 'title' => 'title of new created download', 'user' => get_current_user_id(), // author ID 'result' => 'permalink', // may have 2 options 'permalink' - output will be link to new download 'id' - output will be post id of new download 'category' => 'category name' );
- 'title' - file name
- 'user' - current user ID
- 'result' - 'permalink'
- 'category' => NULL // no category