• Resolved lifeforceinst

    (@lifeforceinst)


    Need the ability to create custom emails for all instances.

    This could be done through a fully configurable settings admin page OR

    As the emails are generated by the emails according to the php files in wp-content/plugins/gdpr/templates/emails, could you make the plugin look in the wp-content/themes/themename/gdpr/templates/email for override templates.

    If this is already possible, please document how this is possible.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Fernando Claussen

    (@fclaussen)

    This is possible exactly how you said it. Add the folder in your theme and it should work.

    Nobody tested this except me in the early days of the plugin. If you can give this a go and let me know.

    Thread Starter lifeforceinst

    (@lifeforceinst)

    I set about creating the following procedure to create customised email bodies (and it does work).

    I could not work out how to change the email subject as it seems to be stored in some internal array.

    Following is a procedure which I successfully used to make customised emails (bodies) using templates.

    1. mkdir mytheme/gdpr/email

    2. copy two files from plugins/gdpr/templates/emails to mytheme/gdpr/email such as:
    index.php and export-data-request.php

    3. Check or set permissions for directory and files to be owned by the webserver.

    4. Customise the test email template, in this case export-data-request.php. If for any reason there is an error in the PHP file it should be noted that the plugin will use the built in template.

    Following is an example of customised export-data-request.php

    <?php
    echo sprintf( esc_html__(
    ‘A request has been received to download your personal data from our website.
    If this was not you, then we recommend that you look to change your password to our website.
    To download your personal data as an XML file, click here: %s
    To download your personal data as a JSON file, click here: %s

    Regards
    Data Privacy Officer
    ‘, ‘gdpr’ ),
    esc_url_raw( $args[‘confirm_url_xml’] ),
    esc_url_raw( $args[‘confirm_url_json’] )
    );

    Thread Starter lifeforceinst

    (@lifeforceinst)

    As an additional note, I am note sure why when I add the following snipped to my functions.php the email message is being sent to and from the same address ([email protected])

    if (! function_exists (‘my_gdpr_sender’)) {
    function lf_gdpr_sender () { return ‘[email protected]’; }
    add_filter (‘gdpr_do_not_reply_address’, ‘my_gdpr_sender’,99);
    }

    Plugin Author Fernando Claussen

    (@fclaussen)

    Subjects can be changed with filters.
    Here’s the array with all the subjects and their respective filters

    	$possible_types = apply_filters(
    			'gdpr_email_types', array(
    				'new-request'              => apply_filters( 'gdpr_new_request_email_subject', esc_html__( 'GDPR Notification: There is a new request waiting to be reviewed.', 'gdpr' ) ),
    				'delete-request'           => apply_filters( 'gdpr_delete_request_email_subject', esc_html__( 'Someone requested to close your account.', 'gdpr' ) ),
    				'delete-resolved'          => apply_filters( 'gdpr_delete_resolved_email_subject', esc_html__( 'Your account has been closed.', 'gdpr' ) ),
    				'rectify-request'          => apply_filters( 'gdpr_rectify_request_email_subject', esc_html__( 'Someone requested that we rectify data of your account.', 'gdpr' ) ),
    				'rectify-resolved'         => apply_filters( 'gdpr_rectify_resolved_email_subject', esc_html__( 'Your request has been completed.', 'gdpr' ) ),
    				'complaint-request'        => apply_filters( 'gdpr_complaint_request_email_subject', esc_html__( 'Someone made complaint on behalf of your account.', 'gdpr' ) ),
    				'complaint-resolved'       => apply_filters( 'gdpr_complaint_resolved_email_subject', esc_html__( 'Your request has been completed.', 'gdpr' ) ),
    				'export-data-request'      => apply_filters( 'gdpr_export_data_request_email_subject', esc_html__( 'Someone requested to download your data.', 'gdpr' ) ),
    				'export-data-resolved'     => apply_filters( 'gdpr_export_data_resolved_email_subject', esc_html__( 'Your request has been completed.', 'gdpr' ) ),
    				'data-breach-request'      => apply_filters( 'gdpr_data_breach_request_email_subject', esc_html__( 'Someone requested to send a data breach notification.', 'gdpr' ) ),
    				'data-breach-notification' => apply_filters( 'gdpr_data_breach_resolved_email_subject', esc_html__( 'Data Breach Notification.', 'gdpr' ) ),
    			)
    		);

    The way I’ve set emails up is from: noreply to: noreply and the actual targets are added as Bcc.

    Thank you for testing the email templates. I’ll add that to the documentation.

    Thread Starter lifeforceinst

    (@lifeforceinst)

    Thanks for the info, this will help for me to make customised emails.

    If you want I can send you my final procedure

    Plugin Author Fernando Claussen

    (@fclaussen)

    Sure. It’s always nice to see other implementations.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Enhancement – custom emails’ is closed to new replies.