- fixed getting email templates for Network active themes;

This commit is contained in:
nikitozzzzzzz
2018-06-06 18:08:27 +03:00
parent ca40103d9b
commit 1f2c65a658
+16 -2
View File
@@ -366,13 +366,20 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
*/
function locate_template( $template_name ) {
// check if there is template at theme folder
$blog_id = $this->get_blog_id();
//get template file from current blog ID folder
$template = locate_template( array(
trailingslashit( 'ultimate-member/email' . $blog_id ) . $template_name . '.php'
) );
//if there isn't template at theme folder for current blog ID get template file from theme folder
if ( is_multisite() && ! $template ) {
$template = locate_template( array(
trailingslashit( 'ultimate-member/email' ) . $template_name . '.php'
) );
}
//if there isn't template at theme folder get template file from plugin dir
if ( ! $template ) {
$path = ! empty( $this->path_by_slug[ $template_name ] ) ? $this->path_by_slug[ $template_name ] : um_path . 'templates/email';
@@ -451,11 +458,18 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
$blog_id = $this->get_blog_id();
// check if there is template at theme folder
// check if there is template at theme blog ID folder
$template = locate_template( array(
trailingslashit( 'ultimate-member/email' . $blog_id ) . $template_name_file . $ext
) );
//if there isn't template at theme folder for current blog ID get template file from theme folder
if ( is_multisite() && ! $template ) {
$template = locate_template( array(
trailingslashit( 'ultimate-member/email' ) . $template_name_file . $ext
) );
}
// Return what we found.
return ! $template ? false : true;
}