Plugin Author
mra13
(@mra13)
That action hook was added a long time ago. The name of the action hooks that were added are the following:
sdm_process_download_request_no_password
sdm_process_download_request_incorrect_password
If you read that file’s code (sdm-download-request-handler.php) and you will see the hooks there so you can customize it.
Please note that we cannot offer code customization as part of the free support. That is beyond the scope of this plugin’s free support capability unfortunately. If you are not a coder, you will need to hire a coder to make code customization.
I am just a novice, I understand and I changed the code into what is below. But after every update it is overwritten. My wish was that you changed YOUR code into something similar that creates a /not-found page that people can design themselves. Would be a lot easier and nicer then the ugly error messages. But thanks anyway… 😉
Line 29:
$dl_post_url = get_permalink( $download_id );
// Change start
header(‘Location: /not-found’); // Change
exit; } // Change
// Change end
// $error_msg = __( ‘Error! This download requires a password.’, ‘simple-download-monitor’ );
// $error_msg .= ‘<p>’;
// $error_msg .= ‘‘ . __( ‘Click here’, ‘simple-download-monitor’ ) . ‘‘;
// $error_msg .= __( ‘ and enter a valid password for this item’, ‘simple-download-monitor’ );
// $error_msg .= ‘</p>’;
// wp_die( $error_msg );
// }
if ( $post_pass != $pass_val ) {
//Incorrect password submitted.
// Change start
header(‘Location: /not-found’); // Change
exit; // Change
// Change end
// do_action( ‘sdm_process_download_request_incorrect_password’ );
// wp_die( __( ‘Error! Incorrect password. This download requires a valid password.’, ‘simple-download-monitor’ ) );
} else {
//Password is valid. Go ahead with the download
}
}
//End of password check
Or in short:
Line 29:
$dl_post_url = get_permalink( $download_id );
header(‘Location: /not-found’);
exit; }
if ( $post_pass != $pass_val ) {
//Incorrect password submitted.
header(‘Location: /not-found’);
exit;
} else {
//Password is valid. Go ahead with the download
}
}
//End of password check
Plugin Author
mra13
(@mra13)
I understand what you are saying but remember that our plugin is used by many users. So we cannot make a global change to the plugin’s output based on what one project’s customization requirements are. There are always other users who may or may not like that change. So the best way to handle a customization is to override things on your site using action or filter hooks. That way the customization is local to your site and you are not modifying the core plugin’s files.
The following is an example snippet of code that shows how you can use the action hook to override the output from your custom plugin or your theme’s functions.php:
add_action('sdm_process_download_request_no_password','my_customization_on_no_pass');
function my_customization_on_no_pass(){
//Output what and how you want to handle this event
}
add_action('sdm_process_download_request_incorrect_password','my_customization_on_incorrect_pass');
function my_customization_on_incorrect_pass(){
//Output what and how you want to handle this event
}
If you want to do customization yourself, you need to read about how hooks work in WordPress. That information will help you understand how you can use hooks to override certain behavior of the plugin and apply customization. Or you need to hire a wp coder who can help you with your customization requirements. Or you can try to find an alternative plugin that has all the customization options that your project needs.
Thanks for your reply..! I look into it. Best regards.
-
This reply was modified 4 years, 8 months ago by
Xonnext.