dev-xiligroup / xili-language-plugin

multilingual plugin for WordPress
4 stars 1 forks source link

Change user language preference #2

Open renoirb opened 9 years ago

renoirb commented 9 years ago

use-case:

  1. If a user wants to change his language preference, he should be able to change it from his profile.
  2. If a WordPress admin user wants to change a user language, he should be able to do it from the edit-user view

    Patch

Made against xili-language v 2.16.1, in file xili-includes/xl-class-admin.php

From c29697f230ed52ba297f59321f0893bf202916d2 Mon Sep 17 00:00:00 2001
From: Renoir Boulanger <renoir@w3.org>
Date: Sun, 10 May 2015 20:23:25 -0400
Subject: [PATCH] dev-xiligroup/xili-language-plugin#2 proposal

---
 xili-includes/xl-class-admin.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xili-includes/xl-class-admin.php b/xili-includes/xl-class-admin.php
index 80cde41..358ec4a 100644
--- a/xili-includes/xl-class-admin.php
+++ b/xili-includes/xl-class-admin.php
@@ -680,9 +680,9 @@ class xili_language_admin extends xili_language {
        update_user_option( get_current_user_id(), 'user_locale', $locale, true );
    }

-   function select_user_dashboard_locale() {
+   function select_user_dashboard_locale( $wp_user ) {
        $available_languages = $this->available_languages( 'orderby=value' );
-       $selected = $this->admin_side_locale();
+       $selected = get_user_option( 'user_locale', $wp_user->ID );

        ?>
        <tr>
--
2.3.4
dev-xiligroup commented 9 years ago

Thanks, This modification (and others depending of this like fixing languages popup in general settings ) will be inserted in future version 2.18 of xili-language. Be patient. M.