diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index 29ff98fc..51c9993e 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -2526,11 +2526,12 @@ Use Only Cookies: mail()->get_template_file( 'theme', $template ); @@ -2545,7 +2546,7 @@ Use Only Cookies: get_blog_id(); + $template = locate_template( array( - trailingslashit( 'ultimate-member/email' ) . $template_name . '.php' + trailingslashit( 'ultimate-member/email' . $blog_id ) . $template_name . '.php' ) ); //if there isn't template at theme folder get template file from plugin dir @@ -446,9 +449,11 @@ if ( ! class_exists( 'um\core\Mail' ) ) { $template_name_file = $this->get_template_filename( $template_name ); $ext = ! $html ? '.php' : '.html'; + $blog_id = $this->get_blog_id(); + // check if there is template at theme folder $template = locate_template( array( - trailingslashit( 'ultimate-member/email' ) . $template_name_file . $ext + trailingslashit( 'ultimate-member/email' . $blog_id ) . $template_name_file . $ext ) ); // Return what we found. @@ -456,6 +461,21 @@ if ( ! class_exists( 'um\core\Mail' ) ) { } + /** + * Check blog ID on multisite, return '' if single site + * + * @return string + */ + function get_blog_id() { + $blog_id = ''; + if ( is_multisite() ) { + $blog_id = '/' . get_current_blog_id(); + } + + return $blog_id; + } + + /** * Method returns expected path for template * @@ -473,7 +493,10 @@ if ( ! class_exists( 'um\core\Mail' ) ) { switch( $location ) { case 'theme': - $template_path = trailingslashit( get_stylesheet_directory() . '/ultimate-member/email' ). $template_name_file . $ext; + //save email template in blog ID folder if we use multisite + $blog_id = $this->get_blog_id(); + + $template_path = trailingslashit( get_stylesheet_directory() . '/ultimate-member/email' . $blog_id ). $template_name_file . $ext; break; case 'plugin': $path = ! empty( $this->path_by_slug[ $template_name ] ) ? $this->path_by_slug[ $template_name ] : um_path . 'templates/email'; @@ -488,8 +511,6 @@ if ( ! class_exists( 'um\core\Mail' ) ) { /** * Ajax copy template to the theme * - * @deprecated since 2.0.17 - * * @param bool $template * @return bool */