Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

Missing user field language

Asked Modified Viewed 981 times
W
Wanabo
W
Wanabo 10
www.probemyip.com/probe-my-ip-80x15.png
pHp-Fusion.Asia & pHp-Fusion.Fr & pHp-Fusion.Cn are available for a localized support community. Send PB for info.
  • Senior Member, joined since
  • Contributed 598 posts on the community forums.
  • Started 94 threads in the forums
  • Started this discussions
asked
Senior Member

I know about and use a language switcher panel, but this setting is only remembered temporarily in a cookie.
It's more professional to have a preference upon registration to have a user field like user language. This is missing now in PHP-fusion!
A registrant should be able to select his preferred language out of the installed languages. The site admin must be able to enable or disable this feature. (which can be done through user field management)

When the user logs in the site must display the preferred language.

Many cms'es has this feature
0 replies

8 posts

F
Falk
F
Falk 131
Need help?, Having trouble?
• View our Documentation for Guides, Standards and Functions
• Name and Organize your Topics and Content correctly in the corresponding Forums for best support results
• Attaching Log Files and Screenshots when reporting issues will help
• Provide with an URL to live example if one exists
• Please read the How to Report an Error post
• Please read and comply with the Code of Conduct

(¯·._.·(¯°·._.·°º*[ Project Manager ]*º°·._.·°¯)·._.·¯)
  • Super Admin, joined since
  • Contributed 6,201 posts on the community forums.
  • Started 639 threads in the forums
  • Answered 11 questions
answered
Super Admin

It have been created for v9.
0 replies
W
Wanabo
W
Wanabo 10
www.probemyip.com/probe-my-ip-80x15.png
pHp-Fusion.Asia & pHp-Fusion.Fr & pHp-Fusion.Cn are available for a localized support community. Send PB for info.
  • Senior Member, joined since
  • Contributed 598 posts on the community forums.
  • Started 94 threads in the forums
  • Started this discussions
answered
Senior Member

Good to know.
0 replies
D
douwe_yntema
D
  • Senior Member, joined since
  • Contributed 667 posts on the community forums.
  • Started 57 threads in the forums
  • Answered 1 question
answered
Senior Member

It is not so difficult to make this work in PF7, but requires an little modification of maincore.php
0 replies
W
Wanabo
W
Wanabo 10
www.probemyip.com/probe-my-ip-80x15.png
pHp-Fusion.Asia & pHp-Fusion.Fr & pHp-Fusion.Cn are available for a localized support community. Send PB for info.
  • Senior Member, joined since
  • Contributed 598 posts on the community forums.
  • Started 94 threads in the forums
  • Started this discussions
answered
Senior Member

I've created some simple custom user fields, but the problem is to link the preferred language so that it is used when a user logs in.
I suppose you are right it requires some more modding.

Can you do it?
0 replies
D
douwe_yntema
D
  • Senior Member, joined since
  • Contributed 667 posts on the community forums.
  • Started 57 threads in the forums
  • Answered 1 question
answered
Senior Member

Mmm I Think the language the user selected is only available AFTER the user is logged in..
Otherwise the system does not know witch user is making the request.

For guests the "cookie system" can be used.

I am working on it, but in my opinion:

In Maincore.php search for: (about line 142 in my version)

// Log in user
if (isset($_POST['login']) && isset($_POST['user_name']) && isset($_POST['user_pass'])) {
   $auth = new Authenticate($_POST['user_name'], $_POST['user_pass'], (isset($_POST['remember_me']) ? true : false));
   $userdata = $auth->getUserData();
   unset($auth, $_POST['user_name'], $_POST['user_pass']);
} elseif (isset($_GET['logout']) && $_GET['logout'] == "yes") {
   $userdata = Authenticate::logOut();
   redirect(BASEDIR."index.php");
} else {
   $userdata = Authenticate::validateAuthUser();
}


and after it add something like:


$language_files = makefilelist(BASEDIR."locale/", ".|..", true, "folders");
if(isset($userdata['yourcreateduserfield']' && preg_match("/^[0-9a-zA-Z_]+$/",$userdata['yourcreateduserfield'] && in_array($userdata['yourcreateduserfield'], $language_files)) {
$settings['locale'] =$userdata['yourcreateduserfield'];
}


Assuming the value in yourcreateduserfield holds the name of the language e.g. Dutch.

Merged on Feb 24 2015 at 22:37:57:
Unfortunaly, the above solution does not work.

The Userdata is loaded after the Language settings are applied.

Looking for something better.

Merged on Feb 24 2015 at 22:49:20:
Getting better if you add this after the previous addition:

include LOCALE.$settings['locale']."/"."global.php";


Merged on Feb 24 2015 at 23:06:32:
Made an infusion for it

http://www.douwe.schoonheidssalonanneke.nl/downloads.php?cat_id=2&download_id=21
Edited by douwe_yntema on 24-02-2015 23:06,
0 replies
W
Wanabo
W
Wanabo 10
www.probemyip.com/probe-my-ip-80x15.png
pHp-Fusion.Asia & pHp-Fusion.Fr & pHp-Fusion.Cn are available for a localized support community. Send PB for info.
  • Senior Member, joined since
  • Contributed 598 posts on the community forums.
  • Started 94 threads in the forums
  • Started this discussions
answered
Senior Member

That looks like a modified version from Developer: Marwelln (Marwelln@gmail.com) language switcher.
I all ready have that on several sites, for example: www.php-fusion.in

But I can see your version retrieves the lang_user from the database and then sets it and uses it.

Nice solution. Thanks.

I will try this on some Belgium sites where I need both Dutch and French.
0 replies
D
douwe_yntema
D
  • Senior Member, joined since
  • Contributed 667 posts on the community forums.
  • Started 57 threads in the forums
  • Answered 1 question
answered
Senior Member

:)
0 replies
C
Chan
C
Chan 0
Lead Developer of PHP-Fusion
  • Super Admin, joined since
  • Contributed 3,841 posts on the community forums.
  • Started 232 threads in the forums
  • Answered 6 questions
answered
Super Admin

To test the multilanguage capabilities of V9, in your url bar, append...

?lang=Russian // or English // or Malay


We have a column call $userdata['user_language'].

If your doing a panel -- :


if (isset($_GET['lang']) && iMEMBER) {
dbquery("UPDATE ".DB_USERS." SET user_language='".LANGUAGE."' WHERE user_id='".intval($userdata['user_id'])."'");
}


That will update your particular user's language preference. Alternatively, just do a User Field Module.

API born for Multilocale.

function - fusion_get_enabled_languages();


$all_enabled_languages_in_your_current_site = fusion_get_enabled_languages();
var_dump($all_enabled_languages_in_your_current_site);


constant - LANGUAGE
Displays your current viewing language.
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 8 posts
  • Votes 0 votes
  • Topic users 4 members

4 participants

F
F
Falk 131
Need help?, Having trouble?
• View our Documentation for Guides, Standards and Functions
• Name and Organize your Topics and Content correctly in the corresponding Forums for best support results
• Attaching Log Files and Screenshots when reporting issues will help
• Provide with an URL to live example if one exists
• Please read the How to Report an Error post
• Please read and comply with the Code of Conduct

(¯·._.·(¯°·._.·°º*[ Project Manager ]*º°·._.·°¯)·._.·¯)
  • Super Admin, joined since
  • Contributed 6,201 posts on the community forums.
  • Started 639 threads in the forums
  • Answered 11 questions
W
W
Wanabo 10
www.probemyip.com/probe-my-ip-80x15.png
pHp-Fusion.Asia & pHp-Fusion.Fr & pHp-Fusion.Cn are available for a localized support community. Send PB for info.
  • Senior Member, joined since
  • Contributed 598 posts on the community forums.
  • Started 94 threads in the forums
  • Started this discussions
C
C
Chan 0
Lead Developer of PHP-Fusion
  • Super Admin, joined since
  • Contributed 3,841 posts on the community forums.
  • Started 232 threads in the forums
  • Answered 6 questions
D
D
  • Senior Member, joined since
  • Contributed 667 posts on the community forums.
  • Started 57 threads in the forums
  • Answered 1 question

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet