• Resolved creationell

    (@creationell)


    Hi
    We are using oxygen builder, that means no child theme possibility. When we edit the body of email templates and save it we get redirected to the list of the email templates without any error message, but the changes are not saved, when we go into template again we see the default version. The settings like subject of the mail are saved though, only the template body doesn’T want to save changes. But even if it would work properly, it would be not good, cause with next UM update the templates can be ovveriden by update and our changes will be gone.

    Because of the missing child theme we are trying to show UM another path to the email templates within another plugin that we created to “simulate” things that usually are done via child theme.
    We tried to use this hook to change the path for the email templates to the directory within of our plugin, but it didn’t work or we are doing something wrong:

    add_filter('um_email_templates_path_by_slug', 'my_email_templates_path_by_slug', 10, 1);
    function my_email_templates_path_by_slug($paths)
    {
        $paths = 'path to the templates within our plugin here';
        return $paths;
    }

    Ist it a right way to do that or it will not work this way and there is another way how we can register another path to the email templates for UM plugin?

    • This topic was modified 3 years ago by creationell. Reason: Updated info about saving the subject line
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @creationell

    You can try this code snippet:

    add_filter("um_locate_email_template","um_111721_change_template_path", 10, 2);
    function um_111721_change_template_path( $template, $template_name ){
    
        $template_path = plugin_dir_path( __FILE__ ) . "emails/" . $template_name .".php";
        return $template_path;
    
    }

    The above code will change the template file path and use the custom plugin’s directory. Sample path: /um2021/app/public/wp-content/plugins/um-code-snippets/emails/approved_email.php

    Regards,

    Thread Starter creationell

    (@creationell)

    HI @champsupertramp
    Thank you very much. It works now ??

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Thanks for letting us know.

    Regards,

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Oxygen builder and email templates’ is closed to new replies.