Edit Template E-Mail without the risk of losing your changes the next update of the plugin

Hello,
I wanted to change the email notification registration confirmation email-template.php
wp-content / plugins / subscribe-by-email / inc / mail-templates /
without the risk of losing your changes the next update of the plugin.

And 'possible to move the file "themename" / subscribe-by-email as well as it does for body, footer, header, post?

Thank you and have a nice day

  • Vinod Dalvi

    Hi @Innovate Srl,

    Thank you for your reply.

    I can see these strings are translated but it contains some HTML tags therefore not getting translated properly.

    I have notified the plugin developer to remove the HTML tags used to wrap these strings.

    In the meanwhile you can change these text by using the attached small plugin that contains the following code.

    function wpmu_gettext_with_context( $translated_text, $untranslated_text, $domain ) {
        if ( 'subscribe-by-email' == $domain ) {
            if (strpos($untranslated_text,'Site Name:') !== false) {
                $untranslated_text = str_replace("Site Name:","Custom Site Name:", $untranslated_text);
            }
            if (strpos($untranslated_text,'Site URL:') !== false) {
    	   		$untranslated_text = str_replace("Site URL:","Custom Site URL:", $untranslated_text);
            }
            if (strpos($untranslated_text,'Confirm subscription') !== false) {
    	   		$untranslated_text = str_replace("Confirm subscription","Custom Confirm subscription", $untranslated_text);
            }
        }
    
        return $untranslated_text;
    }
    add_filter( 'gettext', 'wpmu_gettext_with_context', 10, 3 );

    Please change the custom text in the above plugin code t whatever you want to display in place of these strings.

    The changes made using this plugin is update proof so it won't be deleted on updating the plugin.

    Best Regards,
    Vinod Dalvi

  • HB

    I'm also interested in customizing the look & feel of the confirmation email. It sounds like the quick plugin you sent will address Innovate Srl's 3 pieces of custom text, which is great. Do you have any solutions to suggest for customizing the colors/header/footer of this email so it can resemble the customization possible for the new post notification emails?

    (Would making changes to admin-settings-page.php (placing it in the corresponding location within the child theme) work as a workaround?)

    If not, I'd propose that as an enhancement. Because this confirmation email is the first email that users get after signing up for updates and it would create much stronger branding and user trust if one could customize more visual continuity between the confirmation and the blog & "normal" update emails. It can may sketchy if the first email from a new-to-you service is a generic-looking system email like that. Does that make sense?

  • Kasia Swiderska

    Hello HB,

    Do you have any solutions to suggest for customizing the colors/header/footer of this email so it can resemble the customization possible for the new post notification emails?

    For this you need to modify the wp-content/plugins/subscribe-by-email/inc/mail-templates/confirmation-mail-template.php
    At the top of the file there is function render_mail_template() and inside this function there are styles for conformation e-mail.
    Under this is table with the contents of mail and there you will also see some styling like bgcolor="#EFEFEF" - so this you need also to change.

    Kind regards,
    Kasia

  • Ignacio

    Hi @HB.

    Next version of SBE will include a new filter for this. Please, unzip the attached file and upload to plugins/subscribe-by-email/inc/helpers.

    Now you're ready to override the Confirmation Mail Template Class this way:

    1. Create a new file in your theme or a plugin and use the following code:

    class Custom_Incsub_Subscribe_By_Email_Confirmation_Template extends Incsub_Subscribe_By_Email_Confirmation_Template {
    		public function render_mail_template() {
    			// Render the template code
    			// Copy the content from function render_mail_template() in
    			// subscribe-by-email/inc/mail-templates/confirmation-mail-template.php
    			// and modify it
    		}
    	}

    This class will override the default confirmation class. You only need to fill the render_mail_template function (follow the instructions in the comments).

    2. Now we need to override the default class name:

    add_filter( 'sbe_confirmation_mail_template_class', 'hb_custom_confirmation_template_class' );
    function hb_custom_confirmation_template_class( $class_name ) {
    	include( 'path-to-your-custom-class-file.php' );
    	return 'Custom_Incsub_Subscribe_By_Email_Confirmation_Template';
    }

    And that's it. Let me know if it works for you.

    Regards.
    Ignacio.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.