Below is a list of filters that are available in the Simple Download Monitor plugin.
Note: This documentation is intended for developers only. It requires advanced coding knowledge.
sdm_download_shortcode_output
This filter hook can be used to override the output of the “sdm_download” shortcode. You can use it to output the download item’s info exactly the way you want it to show on the front-end.
Below is an example snippet of code showing how to use this filter.
add_filter('sdm_download_shortcode_output', 'custom_download_output', 10, 2); function custom_download_output($output, $args){ $download_id = $args['id']; $button_text = $args['button_text']; $homepage = get_bloginfo( 'url' ); $download_url = $homepage . '/?smd_process_download=1&download_id=' . $download_id ; //Just as a test lets show the download URL of the item. $output = 'My Test Download URL: ' . $download_url; return $output; }
sdm_latest_downloads_shortcode_output
This filter hook can be used to override the output of the “sdm_latest_downloads” shortcode.
Below is an example snippet of code showing how to use this filter.
add_filter('sdm_latest_downloads_shortcode_output', 'custom_latest_download_output', 10, 3); function custom_latest_download_output($output, $args, $dl_posts){ //print_r($args);//Lets see what arguments have been passed here. //Do something return $output; }
sdm_category_download_items_shortcode_output
This filter hook can be used to override the output of the “sdm_show_dl_from_category” shortcode. It passes the following 3 parameters.
- $output
- $args
- $dl_posts
sdm_download_logs_menu_items_per_page
This filter can be used to override the number of items per page value in the members menu of the plugin.
Below is an example of how to use it:
add_filter('sdm_download_logs_menu_items_per_page', 'my_custom_items_per_page_value'); function my_custom_items_per_page_value($per_page_value) { $per_page_value = 100; //This will show 100 items per page. return $per_page_value; }
sdm_visitor_is_bot
This filter can be used to override what you consider bot via your own custom function. You can read the user-agent value from the server variable.
sdm_download_count_output
It can be used to customize the output of the “sdm_download_counter” shortcode.
sdm_cpt_below_download_description
This filter is triggered just below the description in the individual download item page. It can be used to add extra content in there.
sdm_fancy1_below_download_description
This filter is triggered just below the description in the fancy1 display. It can be used to add extra content in there.
sdm_download_fancy_1_thumbnail
This filter can be used to customize the thumbnail output in the fancy 1 template.
Below is an example snippet of code showing how to use this filter.
add_filter('sdm_download_fancy_1_thumbnail', 'custom_fancy1_thumb_output', 10, 2); function custom_fancy1_thumb_output($thumb_output, $args){ $download_id = $args['id']; $download_thumb_url = get_post_meta($id, 'sdm_upload_thumbnail', true); $thumb_output = '<img src="' . $download_thumb_url . '" class="sdm_download_thumbnail_image" />'; return $thumb_output; }
sdm_download_fancy_2_thumbnail
This filter can be used to customize the thumbnail output in the fancy 2 template. Check the example for the fancy1 template thumbnail customization to see how to use this filter.
sdm_post_type_capability
This filter can be used to override the role requirement for editing the downloads post type items. Example code here.