Plugin Directory

Changeset 1518601


Ignore:
Timestamp:
10/20/2016 01:23:46 PM (9 years ago)
Author:
unclego
Message:

Fix user registration email notification when userc crated from admin panel to be in default language
Other minor tweaks

Location:
admin-language-per-user/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • admin-language-per-user/trunk/admin-language-per-user.php

    r1492502 r1518601  
    33 Plugin Name: Admin Language Per User
    44 Description: Lets you have your backend administration panel in english or any installed language, even if the rest of your blog is translated into another language. Language preferences can be set per user basis in user profile screen. 
    5  Version: 1.0.6
     5 Version: 1.0.7
    66 Author: unclego
    77 License: GPLv3
    88 License URI: http://www.gnu.org/licenses/gpl.html
    9  Tags: translation, translations, i18n, admin, english, localization, backend, language
     9 Tags: translation, translations, i18n, admin, english, localization, backend, language, multisite
    1010 Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6G9LJ5H8GHQ3S
    1111 */
     
    6464        // add locale filter at proper time
    6565        add_action( 'plugins_loaded', array(get_class(), 'plugins_loaded') );
     66
    6667        // add admin language option to user profile
    6768        add_action( 'show_user_profile', array(get_class(), 'user_profile') );
    6869        add_action( 'edit_user_profile', array(get_class(), 'user_profile') );
     70
    6971        // save language option to user profile
    7072        add_action( 'personal_options_update', array(get_class(), 'process_user_option_update') );
    7173        add_action( 'edit_user_profile_update', array(get_class(), 'process_user_option_update') );
     74
     75        // Handle user registration email locale
     76        // Remove locale filter before send notification email (hook with priority 5)
     77        add_action( 'register_new_user', array(get_class(), 'before_wp_send_new_user_notifications'), 5 );
     78        add_action( 'edit_user_created_user', array(get_class(), 'before_wp_send_new_user_notifications'), 5 );
     79
    7280        // Wordpress minimum version check
    7381        register_activation_hook( __FILE__, array(get_class(), 'activate') );
     82
    7483        // cleanup
    7584        register_uninstall_hook(__FILE__, array(get_class(), 'uninstall') );
     
    164173    }
    165174    /**
     175     * Remove plugin locale filter
     176     * and reload default textdomain
     177     */
     178    public static function before_wp_send_new_user_notifications() {
     179        global $locale;
     180        // trick load_default_textdomain() to call get_locale() again
     181        $locale = null;
     182
     183        // remove filter
     184        remove_filter( 'locale', array(get_class(), 'locale') );
     185
     186        // and reload default textdomain
     187        load_default_textdomain();
     188    }
     189    /**
    166190     * @link    https://codex.wordpress.org/Plugin_API/Filter_Reference/locale
    167191     *
     
    191215     *
    192216     * @return boolean
    193      */ 
     217     */
    194218    private static function is_tiny_mce() {
    195219        return false !== strpos( $_SERVER['REQUEST_URI'], '/wp-includes/js/tinymce/');
  • admin-language-per-user/trunk/readme.txt

    r1492505 r1518601  
    22Contributors: unclego
    33Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6G9LJ5H8GHQ3S
    4 Tags: translation, translations, i18n, admin, english, localization, backend
     4Tags: translation, translations, i18n, admin, english, localization, backend, multisite
    55Requires at least: 3.0.1
    66Tested up to: 4.6.1
     
    3434
    3535== Changelog ==
     36= 1.0.7 =
     37= Release date: October 20th, 2016 =
     38* Fix user registration email notification when userc crated from admin panel to be in default language
     39* add HR to highlight user profile admin language section
     40* add multisite tag
     41
    3642= 1.0.6 =
    3743= Release date: September 8th, 2016 =
  • admin-language-per-user/trunk/templates/user-profile.php

    r1492502 r1518601  
    22namespace admin_language_per_user;
    33?>
     4<hr>
    45<h2><?php _e( 'Site Language' ) ?></h2>
    56<table class="form-table">
Note: See TracChangeset for help on using the changeset viewer.