- transferring emails to UM2.0 logic;

- first install email notifications settings;
This commit is contained in:
nikitozzzzzzz
2017-08-29 17:33:10 +03:00
parent 502231671b
commit 472f5d21bc
3 changed files with 46 additions and 6 deletions
+12 -5
View File
@@ -158,9 +158,10 @@ if ( ! class_exists( 'Mail' ) ) {
*
* @access public
* @param string $template_name
* @param bool $html
* @return string
*/
function template_in_theme( $template_name ) {
function template_in_theme( $template_name, $html = false ) {
//WPML compatibility and multilingual email templates
$lang = get_locale();
$arr_english_lang = array( 'en', 'en_US', 'en_NZ', 'en_ZA', 'en_AU', 'en_GB' );
@@ -171,9 +172,11 @@ if ( ! class_exists( 'Mail' ) ) {
$lang .= '/';
}
$ext = ! $html ? '.php' : '.html';
// check if there is template at theme folder
$template = locate_template( array(
trailingslashit( 'ultimate-member/email' ) . $lang . $template_name . '.php'
trailingslashit( 'ultimate-member/email' ) . $lang . $template_name . $ext
) );
// Return what we found.
@@ -187,17 +190,21 @@ if ( ! class_exists( 'Mail' ) ) {
* @access public
* @param string $location
* @param string $template_name
* @param bool $html
* @return string
*/
function get_template_file( $location, $template_name ) {
function get_template_file( $location, $template_name, $html = false ) {
$template_path = '';
$ext = ! $html ? '.php' : '.html';
switch( $location ) {
case 'theme':
$template_path = trailingslashit( get_stylesheet_directory() . '/ultimate-member/email' ) . $template_name . '.php';
$template_path = trailingslashit( get_stylesheet_directory() . '/ultimate-member/email' ) . $template_name . $ext;
break;
case 'plugin':
$path = ! empty( $this->path_by_slug[ $template_name ] ) ? $this->path_by_slug[ $template_name ] : um_path . 'templates/email';
$template_path = trailingslashit( $path ) . $template_name . '.php';
$template_path = trailingslashit( $path ) . $template_name . $ext;
break;
}