If you are a developer and want to customize some of the download monitor code then the following code examples should be helpful.
You can create a small plugin to apply the customization to your site (so all the changes remain outside of the core plugin). You can also apply PHP customization to your site by adding the code to your theme’s functions.php file.
Override the Downloads Post Type Role/Permission
The downloads post type of the plugin is editable by users with ‘administrator’ role. You can override the permission/capability using the following filter:
sdm_post_type_capability
Example Code
Below is an example snippet of code showing how this filter can be used to set the role requirement to Editor and Above. (you can copy and paste this in the functions.php file of your theme):
function override_sdm_post_type_capability( $capability ){ $capability = 'edit_pages';//Allow administrator and editor roles. return $capability; } add_filter( 'sdm_post_type_capability', 'override_sdm_post_type_capability' );
Customize the Output of the Download Shortcode
You can override the output of the download shortcode (that comes from the plugin) by using the following filter:
sdm_download_shortcode_output
Example Code
Below is an example snippet of code showing how to use this filter:
add_filter('sdm_download_shortcode_output', 'custom_download_sc_output', 10, 2); function custom_download_sc_output($output, $args){ //The $args array contains the shortcode parameters (example: download item ID) //Customize the output however you want then return it. //$output = 'TODO'; return $output;//This will be shown as the output of the shortcode }
Customize the Output of the Download Counter Shortcode
You can override the output of the download counter shortcode (sdm_download_counter) by using the following filter:
sdm_download_count_output
Example Code
Below is an example snippet of code showing how to use this filter:
add_filter('sdm_download_count_output', 'custom_download_counter_output', 10, 2); function custom_download_counter_output($output, $args){ //The $args array contains the shortcode parameters (example: download item ID) //Customize the output however you want then return it. //$output = 'TODO'; return $output;//This will be shown as the output of the shortcode }