Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's
Author Message
izone
Involved
Involved


Joined: Sep 07, 2004
Posts: 354
Location: Sweden

PostPosted: Sun Sep 04, 2005 5:18 am Reply with quote

Hello everyone!

I have a Nuke site in english and swedish. I want to when a user change the site language, the language of forum change automaticly.

I found these codes to modify the mainfile.php to do this. But this works only for members. Is there a way to do the same thing for visitors (not members) too?

Here is the codes:

Quote:

in fact it's a phpnuke limitation.
when you change the lang by clicking on the flag, it only changes the cookie. it does not update the user profile.

you can change that though, just find this in mainfile.php (~l.170)

Code:


if ($forum_admin != 1) {
    if (isset($newlang) AND !eregi("\.","$newlang")) {
      if (file_exists("language/lang-".$newlang.".php")) {
          setcookie("lang",$newlang,time()+31536000);
          include("language/lang-".$newlang.".php");
          $currentlang = $newlang;
      } else {
          setcookie("lang",$language,time()+31536000);
          include("language/lang-".$language.".php");
          $currentlang = $language;
      }
   } elseif (isset($lang)) {
      include("language/lang-".$lang.".php");
      $currentlang = $lang;
   } else {
      setcookie("lang",$language,time()+31536000);
      include("language/lang-".$language.".php");
      $currentlang = $language;
    }
}


Quote:
to this :


Code:


if ($forum_admin != 1) {
    if (isset($newlang) AND !eregi("\.","$newlang")) {
      if (file_exists("language/lang-".$newlang.".php")) {
          setcookie("lang",$newlang,time()+31536000);
          include("language/lang-".$newlang.".php");
         // modification marcoledingue 02/05/2005 : modify member's forum profile accordingly (change preferred language)
         if (is_user($user)) {
            cookiedecode($user);
            $uid=$cookie[0];
            $sqlnewlang="UPDATE ".$user_prefix."_users SET user_lang=\"$newlang\" WHERE user_id=$uid";
            $resultnewlang=$db->sql_query($sqlnewlang);
         }
         // end marcoledingue modifications
          $currentlang = $newlang;
      } else {
          setcookie("lang",$language,time()+31536000);
          include("language/lang-".$language.".php");
          $currentlang = $language;
      }
   } elseif (isset($lang)) {
      include("language/lang-".$lang.".php");
      $currentlang = $lang;
   } else {
      setcookie("lang",$language,time()+31536000);
      include("language/lang-".$language.".php");
      $currentlang = $language;
    }
}



I found it on this site: Only registered users can see links on this board! Get registered or login!

Best Regards!
 
View user's profile Send private message
izone
PostPosted: Sun Sep 04, 2005 5:22 am Reply with quote

Sorry I forgot to tell. I am using CNB Your Account last ver. if it does any diffrent for these codes.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©