User.setup

user::setup –– Setup basic user-specific settings - style and language.

Description
Initialise user specific settings: common language file, date format, timezone, daylight savings time, optionally include additional language file(s), and optionally force a specific style for the page.
 * 1) void setup ( [ mixed $lang_set [, int $style ]] )

Return Values
This function always returns NULL

Example #1 A session setup example
In this example, we use the default language file (common.php) and for logged-in users, we use the style set in the user preferences, administrators can specify a &style=x URI param // required to include function files define('IN_PHPBB', true); $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include($phpbb_root_path . 'common.' . $phpEx);

// Start session management $user->session_begin;

// Setup the auth/permissions for this user $auth->acl($user->data);

// setup the user-specific settings, style and language $user->setup;

Example #2 Define additional language files
Additional language files can be loaded via the call to the $user->setup method. To do so, pass the name with the subdirectory but without extension as argument of setup. // load search.php language file $user->setup('search');

// load mods/mylangfile.php language file $user->setup('mods/mylangfile');

// load mods/mylangfile.php AND search.php $user->setup(array('mods/mylangfile', 'search'));

// trick/tip // load mods/mylangfile.php language file board-wide in a shot.. // you'll simply use "user->setup" there in the files where it is not defined, if needed. // (suggested in the case your language file involves quite the entire board, IMHO) // // open includes/sessions.php // FIND $this->add_lang($lang_set); unset($lang_set); // AFTER, ADD $this->add_lang('mods/mylangfile');