1 (edited by hankwang 2007-06-17 13:01)

Topic: Registration language in confirmation email

This might be a boundary case of a bug versus feature, but I'll post it here (in bugs) anyway. I have a bi-lingual forum. When registering, the new user can select a language. However, the confirmation email is in the default language set for the board. That wouldn't be a big problem if it weren't for the fact that a foreign-language email is much more likely to end up in the spam filter of the recipient than when in his/her native language, as is evidenced by the large number of hotmail addresses that signed up but never logged in.

Here's the fix (for punbb 1.2.11; it doesn't seem to be addressed in the updates up to 1.2.15).

File: register.php

        // Add the user
        $db->query('INSERT INTO '.$db->prefix.'users (username, group_id, password, email, email_setting, save_pass, timezone, language, style, registered, registration_ip, last_visit) VALUES(\''.$db->escape($username).'\', '.$intial_group_id.', \''.$password_hash.'\', \''.$email1.'\', '.$email_setting.', '.$save_pass.', '.$timezone.' , \''.$db->escape($language).'\', \''.$pun_config['o_default_style'].'\', '.$now.', \''.get_remote_address().'\', '.$now.')') or error('Unable to create user', __FILE__, __LINE__, $db->error());
        $new_uid = $db->insert_id();

+    
+        // Reset language if different from current default language (affecting email and result page)
+        if ($pun_user['language'] != $language) {
+           global $pun_user, $lang_common, $lang_register;
+           $pun_user['language'] = $language;
+            include PUN_ROOT.'lang/'.$pun_user['language'].'/common.php';
+           include PUN_ROOT.'lang/'.$pun_user['language'].'/register.php';
+       }

Lines with a '+' are new. (I can't provide line numbers since my version already differs quite a bit from the original).

Re: Registration language in confirmation email

Moved to Feature Requests
You're right, that's right on the boundary. We'll have to discuss it a little more smile

Re: Registration language in confirmation email

On the one hand, the user has specified their language and sending out an email in that language is likely to be beneficial to the user.
On the other hand, since the user was able to register we can assume a basic knowledge of English. Plus, if the administrator were to customize the welcome email, he/she would need to customize the email for every language.

4 (edited by hankwang 2007-06-17 13:21)

Re: Registration language in confirmation email

Smartys wrote:

since the user was able to register we can assume a basic knowledge of English.

Well, my forum (see my user info) is in Dutch/Swedish, aimed at people who want to learn the other language. Many of the new members are not anywhere near a basic knowledge of the other language. My customized Punbb install already tries to set the default language depending on what the browser tells in the Accept-Language HTTP headers, but apparently not all browsers have this value set by default.

Plus, if the administrator were to customize the welcome email, he/she would need to customize the email for every language.

That's true, but that's the price I'm willing to pay for setting up a forum that is explicitly bi-lingual. Actually, I do every language customization in English as well, just in case I ever want to use punbb with all my modifications to set up a new forum.

I don't recall whether all languages were included in punbb at installation, or whether I had to download separate language packs after installation. Here at punbb.org, there is no support for other languages than English.

Anyway, if there are too many complications for including this into the default punbb distribution, what is the recommended way to make sure that administrators can find this as a mod?

Re: Registration language in confirmation email

PunBB comes with the English language pack, all other languages need to be downloaded from the site seperately smile
And if you want to create a mod, I want point you to the MDK (it can be found on the downloads page) and PunRes. Alternately, since it's a small code change, you could just add it to the PunRes wiki

Re: Registration language in confirmation email

OK, added to the Wiki now.