Download & history

ImageThis mod, makes guest language chenge depening on the forum they are entering

Moderator: Moderators

Forum rules
The content in this forum is dated Dec. 21 2005 and can be used as Archive only. This Forum is LOCKED and READ ONLY !

Download & history

Postby Niels on Sat 09. Oct, 2004 20:22

I have on reqest, made a mod, witch makes it posible to change the sites language, depending on witch forum the user is browsing.

this makes it posible to have one forum for "english", while another forum is for "italian"..

it's a simple MOD - and I haven't made a ACP interface, the froum ID and language for the specific forum is hardcoded into the MOD - you may change this so it fits your need.

##############################################################
## MOD Title: Language in specific forum
## MOD Author: Niels < ncr@db9.dk > (Niels Chr. Rød) http://mods.db9.dk
## MOD Description: This mod can change guests language depending on the browsing forum
## MOD Version: 0.9.0.
## MOD Compatibility: 2.0.x
##
## Installation Level: Easy
## Installation Time: 1 Minutes (1mn by EasyMOD of Nuttzy)
## Files To Edit: 1
## common.php
##
## Included Files: 0
##
##############################################################
## Author Notes:
##
## 1. Full MOD description
## ----------
## The guests language will change - overwrite the defualt board setting, depending of the forum the user are browsing.
##
## 4. Installation notes
## ----------
## There is NO admin interface yet, instead the forum ID and the language, are HARDCODED - please change this to your needs
##
##############################################################
## MOD History:
## 2004-10-09 - Version 0.9.0
## - initial BETA release
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ OPEN ]------------------------------------------
#
common.php

#
#-----[ FIND ]------------------------------------------
#
?>

#
#-----[ BEFORE, ADD ]------------------------------------------
#
$forum = ( isset($HTTP_POST_VARS[POST_FORUM_URL]) ) ? intval($HTTP_POST_VARS[POST_FORUM_URL]) : ( ( isset($HTTP_GET_VARS[POST_FORUM_URL]) ) ? intval($HTTP_GET_VARS[POST_FORUM_URL]):false);
$topic = ( isset($HTTP_POST_VARS[POST_TOPIC_URL]) ) ? intval($HTTP_POST_VARS[POST_TOPIC_URL]) : ( ( isset($HTTP_GET_VARS[POST_TOPIC_URL]) ) ? intval($HTTP_GET_VARS[POST_TOPIC_URL]):false);
$post = ( isset($HTTP_POST_VARS[POST_POST_URL]) ) ? intval($HTTP_POST_VARS[POST_POST_URL]) : ( ( isset($HTTP_GET_VARS[POST_POST_URL]) ) ? intval($HTTP_GET_VARS[POST_POST_URL]):false);

if (!$forum)
{
if ($topic)
{
// we need to find the forum ID from the DB
$sql="SELECT forum_id FROM ".TOPICS_TABLE." WHERE topic_id='$topic'";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain forum id from topic_id', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$forum = $row['forum_id'];
} else
{
if ($post)
{
$sql="SELECT forum_id FROM ".POSTS_TABLE." WHERE post_id='$post'";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain forum id from post_id', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$forum = $row['forum_id'];
}
}
}
switch ($forum)
{
case 2: $board_config['default_lang'] = 'german';break;
case 12: $board_config['default_lang'] = 'english';break;
case 4: $board_config['default_lang'] = 'danish';break;

}
unset($forum);
unset($topic);
unset($post);

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#

# EoM


the above example changes forum ID 2,12 and 4 to the languages german, english and danish
(if a how-to is EM ready, it will mostly be bullet prof, since a machine is more picky than a human. :D)
User avatar
Niels
Poster
Poster
 
Posts: 4390
Joined: Sat 27. Jul, 2002 15:46

Return to language in specific forum

Who is online

Users browsing this forum: No registered users and 1 guest

cron