1

(5 replies, posted in PunBB 1.4 additions)

I had already installed an older version of nya_fields but it seems to have problem. It changed all the URLs in the forum, for example when i clicked to see a topic it had wrong url.

So, i uninstalled it and i installed the version from the URL you gave me.
Now all the links are OK but i don't see the new field in the profile of the user!

I don't know how i could make it to be visible in the registration form too.

I don't know, i'm a little bit confused and i think that punbb is not the forum for my needs. If i can't create an extra field it makes it poor.

2

(5 replies, posted in PunBB 1.4 additions)

Trace, thank you very much for your reply!

I tried nya_fields but i don't know how can i make this new field i created to be visible on the registration form!
Notice: I use registration approval, so this new field must exist in the users temporary table too (table: post_approval_users).

How can i do that?

3

(5 replies, posted in PunBB 1.4 additions)

Hi,

I would like to add an extra field in user's profile and i want this field to be visible from the registration form.
I have registration approval enabled, so this field must be added first into the users' temporary table and then, after the approval, to be copied into the main "users" table.

How can i insert an extra field?

Any help will be much appreciated!

fristaille wrote:

Great Modification ! Work fine, thanks.

But maybe don't forget to test the cookie too, so the user cannot modify it in order to inject something etc :

if($_GET['lang']) {
        if (file_exists('lang/'.$_GET["lang"].'/common.php')) {
            setcookie("thedefaultlang", $_GET['lang'], time()+3600);
            $TheDefaultLang = $_GET['lang'];
        } else {
            $TheDefaultLang = $forum_config['o_default_lang'];
        }
    } else { 
        if(isset($_COOKIE["thedefaultlang"]) 
           && file_exists('lang/'.$_COOKIE["thedefaultlang"].'/common.php')) {
            $TheDefaultLang = $_COOKIE["thedefaultlang"];
        } else {
            $TheDefaultLang = $forum_config['o_default_lang'];
        }
    }
    $forum_user['language'] = $TheDefaultLang;

Nice addition mate! wink

Which version of PunBB you use and what languages you have?
If you want, post the functions.php and i will change it for you.

6

(1 replies, posted in PunBB 1.4 additions)

My friend, i hope this modification will help you.
Check this out: http://punbb.informer.com/forums/topic/ … um-guests/

I have a multilingual website and i use punbb.
My website is in Greek and English language and all i wanted to achieve was to send the user in the specific language of the forum.
So i made some coding to do that!

This modification sets the language by the url.
So, if you will send the user to yourdomain.com/forums/?lang=Greek the default language of the forum will be Greek.
If you will send the user to yourdomain.com/forums/?lang=English the default language of the forum will be English, and so on...

When the user goes into a specific url of the forum with the lang on it, it creates a cookie to remember it so the language will remain as default as the user surfs in the forum.

If the user is registered and login's into the forum, it ignores this new cookie and shows the forum in the language that the user saved when registered!

So all you need to do is:
1. Open the file include/functions.php
2. Find the line 1558

$forum_user['language'] = $forum_config['o_default_lang'];

3. Replace the line 1558 with the following code

if($_GET['lang']) {
        if (file_exists('lang/'.$_GET["lang"].'/common.php')) {
            setcookie("thedefaultlang", $_GET['lang'], time()+3600);
            $TheDefaultLang = $_GET['lang'];
        } else {
            $TheDefaultLang = $forum_config['o_default_lang'];
        }
    } else { 
        if(isset($_COOKIE["thedefaultlang"])) {
            $TheDefaultLang = $_COOKIE["thedefaultlang"];
        } else {
            $TheDefaultLang = $forum_config['o_default_lang'];
        }
    }
    $forum_user['language'] = $TheDefaultLang;

I hope this will help many others who have multilingual websites like me! smile