Пример #1
0
 function email_template($template, $args = array())
 {
     $lang = '';
     $template_path = false;
     if (function_exists('icl_get_current_language')) {
         if (icl_get_current_language() != 'en') {
             $lang = icl_get_current_language() . '/';
         }
     } else {
         $lang = get_locale();
         if ($lang == 'en_US') {
             $lang = '/';
         } else {
             $lang .= '/';
         }
     }
     if (file_exists(get_stylesheet_directory() . '/ultimate-member/templates/email/' . $lang . $template . '.html')) {
         $template_path = get_stylesheet_directory() . '/ultimate-member/templates/email/' . $lang . $template . '.html';
     }
     if (isset($args['path'])) {
         $path = $args['path'] . $lang;
     } else {
         $path = um_path . 'templates/email/' . $lang;
     }
     if (file_exists($path . $template . '.html')) {
         $template_path = $path . $template . '.html';
     }
     return apply_filters('um_email_template_path', $template_path, $template, $args);
 }
Пример #2
0
 function email_template($template, $args = array())
 {
     $lang = '';
     $template_path = false;
     if (function_exists('icl_get_current_language')) {
         if (icl_get_current_language() != 'en') {
             $lang = icl_get_current_language() . '/';
         }
     } else {
         $lang = get_locale();
         $arr_english_lang = array('en', 'en_US', 'en_NZ', 'en_ZA', 'en_AU', 'en_GB');
         if (in_array($lang, $arr_english_lang) || strpos($lang, 'en_') > -1 || empty($lang) || $lang == 0) {
             $lang = '';
         } else {
             $lang .= '/';
         }
     }
     if (file_exists(get_stylesheet_directory() . '/ultimate-member/templates/email/' . $lang . $template . '.html')) {
         $template_path = get_stylesheet_directory() . '/ultimate-member/templates/email/' . $lang . $template . '.html';
     } else {
         if (isset($args['path'])) {
             $path = $args['path'] . $lang;
         } else {
             $path = um_path . 'templates/email/' . $lang;
         }
         if (file_exists($path . $template . '.html')) {
             $template_path = $path . $template . '.html';
         }
     }
     return apply_filters('um_email_template_path', $template_path, $template, $args);
 }
function um_submit_account_details($args)
{
    global $ultimatemember;
    $tab = get_query_var('um_tab') ? get_query_var('um_tab') : 'general';
    if ($_POST['user_password'] && $_POST['confirm_user_password']) {
        $changes['user_pass'] = $_POST['user_password'];
        add_filter('send_password_change_email', 'um_send_password_change_email');
    }
    foreach ($_POST as $k => $v) {
        if (!strstr($k, 'password') && !strstr($k, 'um_account')) {
            $changes[$k] = $v;
        }
    }
    if (isset($changes['hide_in_members']) && $changes['hide_in_members'] == __('No', 'ultimatemember')) {
        delete_user_meta(um_user('ID'), 'hide_in_members');
        unset($changes['hide_in_members']);
    }
    // fired on account page, just before updating profile
    do_action('um_account_pre_update_profile', $changes, um_user('ID'));
    $ultimatemember->user->update_profile($changes);
    // delete account
    if ($_POST['single_user_password'] && $tab == 'delete') {
        if (current_user_can('delete_users') || um_user('can_delete_profile')) {
            if (!um_user('super_admin')) {
                $ultimatemember->user->delete();
                if (um_user('after_delete') && um_user('after_delete') == 'redirect_home') {
                    um_redirect_home();
                } elseif (um_user('delete_redirect_url')) {
                    exit(wp_redirect(um_user('delete_redirect_url')));
                } else {
                    um_redirect_home();
                }
            }
        }
    }
    do_action('um_post_account_update');
    do_action('um_after_user_account_updated', get_current_user_id());
    $url = $ultimatemember->account->tab_link($tab);
    $url = add_query_arg('updated', 'account', $url);
    if (function_exists('icl_get_current_language')) {
        if (icl_get_current_language() != icl_get_default_language()) {
            $url = $ultimatemember->permalinks->get_current_url(true);
            $url = add_query_arg('updated', 'account', $url);
            exit(wp_redirect($url));
        }
    }
    exit(wp_redirect($url));
}
 function rewrite_rules()
 {
     global $ultimatemember;
     if (isset($ultimatemember->permalinks->core['user'])) {
         $user_page_id = $ultimatemember->permalinks->core['user'];
         $account_page_id = $ultimatemember->permalinks->core['account'];
         $user = get_post($user_page_id);
         if (isset($user->post_name)) {
             $user_slug = $user->post_name;
             $account = get_post($account_page_id);
             $account_slug = $account->post_name;
             $add_lang_code = '';
             if (function_exists('icl_object_id') || function_exists('icl_get_current_language')) {
                 if (function_exists('icl_get_current_language')) {
                     $language_code = icl_get_current_language();
                 } else {
                     if (function_exists('icl_object_id') && defined('ICL_LANGUAGE_CODE')) {
                         $language_code = ICL_LANGUAGE_CODE;
                     }
                 }
                 // User page translated slug
                 $lang_post_id = icl_object_id($user->ID, 'post', FALSE, $language_code);
                 $lang_post_obj = get_post($lang_post_id);
                 if (isset($lang_post_obj->post_name)) {
                     $user_slug = $lang_post_obj->post_name;
                 }
                 // Account page translated slug
                 $lang_post_id = icl_object_id($account->ID, 'post', FALSE, $language_code);
                 $lang_post_obj = get_post($lang_post_id);
                 if (isset($lang_post_obj->post_name)) {
                     $account_slug = $lang_post_obj->post_name;
                 }
                 if ($language_code != icl_get_default_language()) {
                     $add_lang_code = $language_code;
                 }
             }
             add_rewrite_rule($user_slug . '/([^/]+)/?$', 'index.php?page_id=' . $user_page_id . '&um_user=$matches[1]&lang=' . $add_lang_code, 'top');
             add_rewrite_rule($account_slug . '/([^/]+)?$', 'index.php?page_id=' . $account_page_id . '&um_tab=$matches[1]&lang=' . $add_lang_code, 'top');
             if (!apply_filters('um_rewrite_flush_rewrite_rules', um_get_option('um_flush_stop'))) {
                 flush_rewrite_rules(true);
             }
         }
     }
 }
Пример #5
0
 function email_template($template, $args = array())
 {
     $lang = '';
     if (function_exists('icl_get_current_language')) {
         if (icl_get_current_language() != 'en') {
             $lang = icl_get_current_language() . '/';
         }
     }
     if (file_exists(get_stylesheet_directory() . '/ultimate-member/templates/email/' . $lang . $template . '.html')) {
         return get_stylesheet_directory() . '/ultimate-member/templates/email/' . $lang . $template . '.html';
     }
     if (isset($args['path'])) {
         $path = $args['path'] . $lang;
     } else {
         $path = um_path . 'templates/email/' . $lang;
     }
     if (file_exists($path . $template . '.html')) {
         return $path . $template . '.html';
     }
     return false;
 }
function um_localize_permalink_filter($core_pages, $page_id, $profile_url)
{
    global $ultimatemember;
    if (function_exists('icl_get_current_language') && icl_get_current_language() != icl_get_default_language()) {
        if (get_the_ID() > 0 && get_post_meta(get_the_ID(), '_um_wpml_user', true) == 1) {
            $profile_url = get_permalink(get_the_ID());
        }
    }
    // WPML compatibility
    if (function_exists('icl_object_id')) {
        $language_code = ICL_LANGUAGE_CODE;
        $lang_post_id = icl_object_id($page_id, 'page', true, $language_code);
        if ($lang_post_id != 0) {
            $profile_url = get_permalink($lang_post_id);
        } else {
            // No page found, it's most likely the homepage
            global $sitepress;
            $profile_url = $sitepress->language_url($language_code);
        }
    }
    return $profile_url;
}
Пример #7
0
 function profile_url()
 {
     global $ultimatemember;
     $page_id = $this->core['user'];
     $profile_url = get_permalink($page_id);
     if (function_exists('icl_get_current_language') && icl_get_current_language() != icl_get_default_language()) {
         if (get_the_ID() > 0 && get_post_meta(get_the_ID(), '_um_wpml_user', true) == 1) {
             $profile_url = get_permalink(get_the_ID());
         }
     }
     // WPML compatibility
     if (function_exists('icl_object_id')) {
         $language_code = ICL_LANGUAGE_CODE;
         $lang_post_id = icl_object_id($page_id, 'page', true, $language_code);
         if ($lang_post_id != 0) {
             $profile_url = get_permalink($lang_post_id);
         } else {
             // No page found, it's most likely the homepage
             global $sitepress;
             $profile_url = $sitepress->language_url($language);
         }
     }
     if (um_get_option('permalink_base') == 'user_login') {
         $user_in_url = um_user('user_login');
         if (is_email($user_in_url)) {
             $user_in_url = str_replace('@', '', $user_in_url);
             if (($pos = strrpos($user_in_url, '.')) !== false) {
                 $search_length = strlen('.');
                 $user_in_url = substr_replace($user_in_url, '-', $pos, $search_length);
             }
         } else {
             $user_in_url = sanitize_title($user_in_url);
         }
     }
     if (um_get_option('permalink_base') == 'user_id') {
         $user_in_url = um_user('ID');
     }
     if (um_get_option('permalink_base') == 'name') {
         $user_in_url = rawurlencode(strtolower(str_replace(" ", ".", um_user('full_name'))));
     }
     if (um_get_option('permalink_base') == 'name_dash') {
         $user_in_url = rawurlencode(strtolower(str_replace(" ", "-", um_user('full_name'))));
     }
     if (um_get_option('permalink_base') == 'name_plus') {
         $user_in_url = strtolower(str_replace(" ", "+", um_user('full_name')));
     }
     if (get_option('permalink_structure')) {
         $profile_url = trailingslashit(untrailingslashit($profile_url));
         $profile_url = $profile_url . $user_in_url . '/';
     } else {
         $profile_url = add_query_arg('um_user', $user_in_url, $profile_url);
     }
     return $profile_url;
 }
 /**
  * Build wishlist page URL.
  * 
  * @return string
  * @since 1.0.0
  */
 public function get_wishlist_url($action = 'view')
 {
     $wishlist_page_id = get_option('yith_wcwl_wishlist_page_id');
     $wishlist_page_id = function_exists('icl_object_id') ? icl_object_id($wishlist_page_id, 'page', true) : $wishlist_page_id;
     if (get_option('permalink_structure') && !defined('ICL_PLUGIN_PATH')) {
         $wishlist_permalink = trailingslashit(get_the_permalink($wishlist_page_id));
         $base_url = trailingslashit($wishlist_permalink . $action);
     } else {
         $base_url = get_the_permalink($wishlist_page_id);
         $action_params = explode('/', $action);
         $params = array();
         if (isset($action_params[1])) {
             $action = $action_params[0];
             $params['wishlist-action'] = $action;
             if ($action == 'view') {
                 $params['wishlist_id'] = $action_params[1];
             } elseif ($action == 'user') {
                 $params['user_id'] = $action_params[1];
             }
         } else {
             $params['wishlist-action'] = $action;
         }
         $base_url = add_query_arg($params, $base_url);
     }
     if (defined('ICL_PLUGIN_PATH')) {
         $base_url = add_query_arg('lang', icl_get_current_language(), $base_url);
     }
     return apply_filters('yith_wcwl_wishlist_page_url', esc_url_raw($base_url));
 }
Пример #9
0
function um_get_core_page($slug, $updated = false)
{
    global $ultimatemember;
    $url = '';
    if (isset($ultimatemember->permalinks->core[$slug])) {
        $url = get_permalink($ultimatemember->permalinks->core[$slug]);
        if ($updated) {
            $url = add_query_arg('updated', esc_attr($updated), $url);
        }
    }
    if (function_exists('icl_get_current_language') && icl_get_current_language() != icl_get_default_language()) {
        $url = um_get_url_for_language($ultimatemember->permalinks->core[$slug], icl_get_current_language());
        if (get_post_meta(get_the_ID(), '_um_wpml_account', true) == 1) {
            $url = get_permalink(get_the_ID());
        }
        if (get_post_meta(get_the_ID(), '_um_wpml_user', true) == 1) {
            $url = um_get_url_for_language($ultimatemember->permalinks->core[$slug], icl_get_current_language());
        }
    }
    if ($url) {
        $url = apply_filters('um_get_core_page_filter', $url, $slug, $updated);
        return $url;
    }
    return '';
}
Пример #10
0
 function profile_url()
 {
     global $ultimatemember;
     $page_id = $this->core['user'];
     $profile_url = get_permalink($page_id);
     if (function_exists('icl_get_current_language') && icl_get_current_language() != icl_get_default_language()) {
         if (get_the_ID() > 0 && get_post_meta(get_the_ID(), '_um_wpml_user', true) == 1) {
             $profile_url = get_permalink(get_the_ID());
         }
     }
     if (um_get_option('permalink_base') == 'user_login') {
         $user_in_url = um_user('user_login');
         if (is_email($user_in_url)) {
             $user_in_url = str_replace('@', '', $user_in_url);
             if (($pos = strrpos($user_in_url, '.')) !== false) {
                 $search_length = strlen('.');
                 $user_in_url = substr_replace($user_in_url, '-', $pos, $search_length);
             }
         } else {
             $user_in_url = sanitize_title($user_in_url);
         }
     }
     if (um_get_option('permalink_base') == 'user_id') {
         $user_in_url = um_user('ID');
     }
     if (um_get_option('permalink_base') == 'name') {
         $user_in_url = rawurlencode(strtolower(um_user('full_name')));
     }
     if (get_option('permalink_structure')) {
         $profile_url = trailingslashit(untrailingslashit($profile_url));
         $profile_url = $profile_url . $user_in_url . '/';
     } else {
         $profile_url = add_query_arg('um_user', $user_in_url, $profile_url);
     }
     return $profile_url;
 }
Пример #11
0
    ?>
" />
	<?php 
    if (!empty($active_post_lock)) {
        ?>
		<input type="hidden" id="active_post_lock"
						value="<?php 
        echo esc_attr(implode(':', $active_post_lock));
        ?>
" /><?php 
    }
    if (function_exists('icl_get_current_language')) {
        ?>
		<input type="hidden" id="icl_post_language" name="icl_post_language"
						value="<?php 
        echo stripslashes(icl_get_current_language());
        ?>
" /><?php 
    }
    if ('draft' != get_post_status($post)) {
        wp_original_referer_field(true, 'previous');
    }
    echo $form_extra;
    $fields = $emrede->getFields();
    EmRede::print_field($fields['post_title']);
    EmRede::print_field($fields['email']);
    EmRede::print_field($fields['url']);
    EmRede::print_field($fields['telefone']);
    EmRede::print_field('territorio', array('label' => 'Estado e Cidade', 'required' => true, 'type' => 'estadocidade'));
    ?>
	<div class="emrede-map-block">