mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
- fixes for email templates save process
- fixes for multilanguage email templates;
This commit is contained in:
@@ -2579,7 +2579,9 @@ Use Only Cookies: <?php echo ini_get( 'session.use_only_cookies' ) ?
|
|||||||
|
|
||||||
$theme_template_path = UM()->mail()->get_template_file( 'theme', $template );
|
$theme_template_path = UM()->mail()->get_template_file( 'theme', $template );
|
||||||
|
|
||||||
UM()->mail()->copy_email_template( $template );
|
if ( ! file_exists( $theme_template_path ) ) {
|
||||||
|
UM()->mail()->copy_email_template( $template );
|
||||||
|
}
|
||||||
|
|
||||||
$fp = fopen( $theme_template_path, "w" );
|
$fp = fopen( $theme_template_path, "w" );
|
||||||
$result = fputs( $fp, $content );
|
$result = fputs( $fp, $content );
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ if ( ! class_exists( 'um\core\External_Integrations' ) ) {
|
|||||||
add_filter( 'icl_ls_languages', array( &$this, 'um_core_page_wpml_permalink' ), 10, 1 );
|
add_filter( 'icl_ls_languages', array( &$this, 'um_core_page_wpml_permalink' ), 10, 1 );
|
||||||
|
|
||||||
// Integration for the "Transposh Translation Filter" plugin
|
// Integration for the "Transposh Translation Filter" plugin
|
||||||
add_action( 'template_redirect', array( &$this, 'transposh_user_profile'), 9990 );
|
add_action( 'template_redirect', array( &$this, 'transposh_user_profile' ), 9990 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @todo Customize this form metadata
|
* @todo Customize this form metadata
|
||||||
@@ -362,6 +362,12 @@ if ( ! class_exists( 'um\core\External_Integrations' ) ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $template
|
||||||
|
* @param $template_name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
function locate_email_template( $template, $template_name ) {
|
function locate_email_template( $template, $template_name ) {
|
||||||
if ( ! $this->is_wpml_active() ) {
|
if ( ! $this->is_wpml_active() ) {
|
||||||
return $template;
|
return $template;
|
||||||
@@ -391,6 +397,11 @@ if ( ! class_exists( 'um\core\External_Integrations' ) ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $template
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
function change_email_template_file( $template ) {
|
function change_email_template_file( $template ) {
|
||||||
if ( ! $this->is_wpml_active() ) {
|
if ( ! $this->is_wpml_active() ) {
|
||||||
return $template;
|
return $template;
|
||||||
@@ -407,7 +418,11 @@ if ( ! class_exists( 'um\core\External_Integrations' ) ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $columns
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
function add_email_templates_wpml_column( $columns ) {
|
function add_email_templates_wpml_column( $columns ) {
|
||||||
if ( ! $this->is_wpml_active() ) {
|
if ( ! $this->is_wpml_active() ) {
|
||||||
return $columns;
|
return $columns;
|
||||||
@@ -438,6 +453,11 @@ if ( ! class_exists( 'um\core\External_Integrations' ) ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $item
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
function wpml_column_content( $item ) {
|
function wpml_column_content( $item ) {
|
||||||
if ( ! $this->is_wpml_active() ) {
|
if ( ! $this->is_wpml_active() ) {
|
||||||
return '';
|
return '';
|
||||||
@@ -456,6 +476,12 @@ if ( ! class_exists( 'um\core\External_Integrations' ) ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $template
|
||||||
|
* @param $code
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
function get_status_html( $template, $code ) {
|
function get_status_html( $template, $code ) {
|
||||||
global $sitepress;
|
global $sitepress;
|
||||||
$status = 'add';
|
$status = 'add';
|
||||||
@@ -478,14 +504,21 @@ if ( ! class_exists( 'um\core\External_Integrations' ) ) {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$language_codes = $this->get_languages_codes($code);
|
$language_codes = $this->get_languages_codes( $code );
|
||||||
|
|
||||||
$lang = '';
|
$lang = '';
|
||||||
if ( $language_codes['default'] != $language_codes['current'] ) {
|
if ( $language_codes['default'] != $language_codes['current'] ) {
|
||||||
$lang = $language_codes['current'] . '/';
|
$lang = $language_codes['current'] . '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//theme location
|
||||||
$template_path = trailingslashit( get_stylesheet_directory() . '/ultimate-member/email' ) . $lang . $template . '.php';
|
$template_path = trailingslashit( get_stylesheet_directory() . '/ultimate-member/email' ) . $lang . $template . '.php';
|
||||||
|
|
||||||
|
//plugin location for default language
|
||||||
|
if ( empty( $lang ) && ! file_exists( $template_path ) ) {
|
||||||
|
$template_path = UM()->mail()->get_template_file( 'plugin', $template );
|
||||||
|
}
|
||||||
|
|
||||||
if ( file_exists( $template_path ) ) {
|
if ( file_exists( $template_path ) ) {
|
||||||
$status = 'edit';
|
$status = 'edit';
|
||||||
}
|
}
|
||||||
@@ -495,6 +528,14 @@ if ( ! class_exists( 'um\core\External_Integrations' ) ) {
|
|||||||
return $this->render_status_icon( $link, $translation[ $status ]['text'], $translation[ $status ]['icon'] );
|
return $this->render_status_icon( $link, $translation[ $status ]['text'], $translation[ $status ]['icon'] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $link
|
||||||
|
* @param $text
|
||||||
|
* @param $img
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
function render_status_icon( $link, $text, $img ) {
|
function render_status_icon( $link, $text, $img ) {
|
||||||
|
|
||||||
$icon_html = '<a href="' . $link . '" title="' . $text . '">';
|
$icon_html = '<a href="' . $link . '" title="' . $text . '">';
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace um\core;
|
namespace um\core;
|
||||||
|
|
||||||
|
|
||||||
// Exit if accessed directly
|
// Exit if accessed directly
|
||||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||||
|
|
||||||
|
|
||||||
if ( ! class_exists( 'um\core\Mail' ) ) {
|
if ( ! class_exists( 'um\core\Mail' ) ) {
|
||||||
|
|
||||||
|
|
||||||
@@ -392,8 +394,13 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
|
|||||||
*/
|
*/
|
||||||
function send( $email, $template, $args = array() ) {
|
function send( $email, $template, $args = array() ) {
|
||||||
|
|
||||||
if ( ! is_email( $email ) ) return;
|
if ( ! is_email( $email ) ) {
|
||||||
if ( UM()->options()->get( $template . '_on' ) != 1 ) return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( UM()->options()->get( $template . '_on' ) != 1 ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$this->attachments = null;
|
$this->attachments = null;
|
||||||
$this->headers = 'From: '. UM()->options()->get('mail_from') .' <'. UM()->options()->get('mail_from_addr') .'>' . "\r\n";
|
$this->headers = 'From: '. UM()->options()->get('mail_from') .' <'. UM()->options()->get('mail_from_addr') .'>' . "\r\n";
|
||||||
@@ -485,7 +492,11 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
|
|||||||
) );
|
) );
|
||||||
|
|
||||||
// Return what we found.
|
// Return what we found.
|
||||||
return ! $template ? false : true;
|
if ( get_template_directory() === get_stylesheet_directory() ) {
|
||||||
|
return ! $template ? false : true;
|
||||||
|
} else {
|
||||||
|
return strstr( $template, get_stylesheet_directory() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user