Hey guys,
i´ve been working on this for 2 days now... and cant figure it out... i hope you can give me some tips...
I want to let my users change there lang in a easy way... so i´ve done this so far, look the picture...
Deactivated the lang select function in page_header, an put the function in a block file, and the added the block file as global block via CMS...
Works pretty good! ...
BUT: only for guests...
I want to allow loggedin users this feature too... I tried to take some functions from usercp_register but cant get this to work if the user is logged in...
Can someone help me the add the needed code lines/sql queries to update the users lang in the DB...
here is my work so far...
blocks\blocks_imp_lang.php
<?php
/**
*
* @package Icy Phoenix
* @version $Id: blocks_imp_lang.php 49 2008-09-14 20:36:03Z Mighty Gorgon $
* @copyright (c) 2008 Icy Phoenix
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
if (!defined('IN_ICYPHOENIX'))
{
die('Hacking attempt');
}
if(!function_exists('imp_lang_block_func'))
{
function imp_lang_block_func()
{
global $template, $lang, $board_config, $userdata;
// Mighty Gorgon - Change Lang/Style - Begin
if ((($board_config['select_lang'] == true) && (!$userdata['session_logged_in'])))
{
include_once(IP_ROOT_PATH . 'includes/functions_selects.' . PHP_EXT);
if (($board_config['select_lang'] == true) && (!$userdata['session_logged_in']))
{
$template->assign_block_vars('lang_select_on', array());
$lang_installed = language_select_h($board_config['default_lang'], 'language');
while (list($displayname) = @each($lang_installed))
{
$lang_value = $displayname;
$lang_name = ucwords($displayname);
$template->assign_block_vars('lang_select_on.lang_select', array(
'LANG_FLAG' => 'language/lang_' . $displayname . '/flag.png',
'LANG_NAME' => $lang_name,
'LANG_VALUE'=> $lang_value,
'U_LANG_CHANGE'=> append_sid('changelang.' . PHP_EXT . '?' . LANG_URL . '=' . $lang_value),
)
);
}
}
}
// Mighty Gorgon - Change Lang/Style - End
}
}
imp_lang_block_func();
?>
templates\default\blocks\lang_block.tpl
<!-- BEGIN lang_select_on -->
<table class="empty-table" width="100%" cellspacing="0" cellpadding="0" border="0">
<!-- BEGIN lang_select -->
<tr>
<td>
<br /><a href="{lang_select_on.lang_select.U_LANG_CHANGE}">
<img src="{lang_select_on.lang_select.LANG_FLAG}" alt="{lang_select_on.lang_select.LANG_NAME}" />
</a>
</td>
</tr>
<!-- END lang_select -->
</table>
<!-- END lang_select_on -->
Thanks in advance!