Below is a list of action hooks that are available in the Simple Download Monitor plugin.
Note: This documentation is intended for developers only. It requires advanced coding knowledge.
sdm_process_download_request
Can be used to to hook into the download request and override it with your custom coding.
Below is an example snippet of code showing how you can override the download process:
add_action('sdm_process_download_request', 'custom_download', 10, 2); function custom_download($download_id, $download_link){ //TODO - handle the dispatching of the download //exit here after the dispatching so the download sequence ends }
sdm_downloads_post_type_before_register
This action hook can be used to customize/override the downloads slug base.
The default downloads slug is “sdm_downloads”. The following code example shows how this can be changed to “my-sdm-slug”:
function sdm_handle_change_downloads_slug( $args ) { $args['rewrite'] = array( 'slug' => 'my-sdm-slug' ); return $args; } add_action( 'sdm_downloads_post_type_before_register', 'sdm_handle_change_downloads_slug' );
Note: If you use the above custom tweak, you will need to go to the “Permalinks” menu of your WordPress dashboard and re-save it. Saving the “Permalinks” settings forces your site to flush the re-write rules (which is required for this change to take effect).