Hi Florian,
You are welcome!
Yes it is possible to invoke the shortcode with your own custom attributes. It is advisable to prefix your attribute so that the name does not conflict with existing or future attributes of the plugin. Currently only “id” and “css” are in use.
You could use your custom attribute, for example, to add a hidden field to the download form and use its value after the submission of the download form. In the code example below let’s say we have the following shortcode:
[download_after_email id=”123456″ cst_email=”[email protected]”]
add_filter( 'dae_shortcode_html_fields', 'cst_add_hidden_download_form_field', 20, 3 );
function cst_add_hidden_download_form_field( $html_fields, $file_name, $atts ) {
if ( empty( $atts['cst_email'] ) ) {
return $html_fields;
}
$html_fields .= '<input type="hidden" name="cst_email" value="' . esc_attr( $atts['cst_email'] ) . '" />';
return $html_fields;
}
add_action( 'dae_after_send_downloadlink', 'cst_action_hidden_download_form_field' );
function cst_action_hidden_download_form_field( $subscriber_id ) {
if ( empty( $_POST['cst_email'] ) ) {
return;
}
$cst_email = $_POST['cst_email'];
}
Kind regards,
Team Download After Email