News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

problem with the Language Button Menu mod

Started by glennmckenna, May 04, 2013, 08:39:54 AM

Previous topic - Next topic

glennmckenna

hi
I've installed the mod
http://custom.simplemachines.org/mods/index.php?mod=2705
add my host I giving me this error  at the top of the page
QuoteNotice: Undefined index: id in /home/a4787346/public_html/new/forum/Sources/Subs-LanguageMenu.php on line 53

here is a copy of the script that it's talking about
<?php
/**
 * Language Menu for SMF (LMSMF)
 *
 * @package LMSMF
 * @author [Marcelo]
 * @2nd-author emanuele
 * @copyright 2012 [Marcelo], Simple Machines
 * @license http://www.simplemachines.org/about/smf/license.php BSD
 *
 * @version 3.0.1
 */
/**********************************************************************************
* LanguageMenu                                                                *
***********************************************************************************
* A modification to show an advanced language menu written for                    *
* SMF: Simple Machines Forum                                                      *
* =============================================================================== *
* Software Version:       LanguageMenu 3.01                                     *
* Software by:            Marcelo Navarrete (http://iluminandoclasicas.com.ar)    *
* Copyright by:           IluminandoClasicsas (http://iluminandoclasicas.com.ar)  *
* Support, News, Updates at: http://www.simplemachines.org                        *
***********************************************************************************

***********************************************************************************
* IMPORTANT!!!!!!:                                                                *
***********************************************************************************
* We kindly ask you to keep the language icon that identify the choose/select     *
* or switch option for languageLanguage Menu.                                     *
* This language icon is an initiative to standardise language selection icon.     *
* If you feel that the size or the default color of the language icon doesn't fit *
* with your theme: at http://www.languageicon.org/index-icon.php you can download *
* any of the language icons free, choose from 61 different colors and styles.     *
* You are using this software for free please help to standarize the              *
* language icon, keeping it in your site. :)                                      *
***********************************************************************************/

if (!defined('SMF'))
die('Hacking attempt...');
    
function 
LanguageMenu_Language_Checks ()
{
    global 
$context$user_info

    
// Language Checking.
if (isset($_POST['languagemenu']))
{
if (empty($context['languages']))
$languages getLanguages();

if (isset($languages[$_POST['languagemenu']]))
{
updateMemberData($user_info['id'], array('lngfile' => $_POST['languagemenu']));
$user_info['language'] = $_POST['languagemenu'];
$_SESSION['language'] = $_POST['languagemenu'];
}
}
}
   
function 
show_language_menu()
{
global $context$txt$scripturl$modSettings$smcFunc$settings;

//Load language $txt strings
    
loadLanguage('LanguageMenu/LanguageMenu');
    
if ($modSettings['language_menu_activate'] == 1)
{
// Obtain our languages
if (empty($context['languages']))
getLanguages();
// And then our labels 
        
foreach ($context['languages'] as $temp)         
        {
        if (!empty (
$modSettings['lang_menu_label_'.$temp['filename']])) $custom_label [$temp['filename']] = $modSettings['lang_menu_label_'.$temp['filename']];
        }
    
// Do we want custom labels?   
    
if (empty($modSettings['language_menu_activate_custom_labels'])) unset($custom_label);   

// Hopefully We always have something to show  
if (!empty ($context['languages']))
{
echo'
<div id="language_menu">
<img class="langicon" src="'
$settings['default_theme_url'], '/images/LanguageMenuImg/langicon.png" height="16px" width="16px" alt=" " />';
// Do we want a drop language menu?
if ($modSettings['language_menu_tamplate'] == 'drop_menu')
{
echo $txt['language_menu_select_language'], '
<form action="" method="post">
<select id="language_select" name="languagemenu" onchange="this.form.submit()">'
;
foreach ($context['languages'] as $language)
                {
$language_button str_replace("-utf8","",$language['name']);
if (isset($custom_label[$language['filename']])) $language_button $custom_label[$language['filename']]; 
echo '
<option value="'
$language['filename'], '"', isset($context['user']['language']) && $context['user']['language'] == $language['filename'] ? ' selected="selected"' '''>' ,$language_button'</option>';
}
echo'
</select><input type="hidden" name="changelang" value="1" />
<noscript><input type="submit" value="'
$txt['quick_mod_go'], '" /></noscript>
</form>'
;
}
// Or perhaps a nice flag icon menu?
elseif ($modSettings['language_menu_tamplate'] == 'icon_menu')
{
foreach ($context['languages'] as $language)
{
$language_button str_replace("-utf8","",$language['name']);
if (isset($custom_label[$language['filename']])) $language_button $custom_label[$language['filename']]; 
echo '
<form action="" method="post">
<input type="hidden" name="languagemenu" value="'
$language['filename'], '" />
<button id="'
$language['filename'], '" type="submit" value="'$language['name'], '"', isset($context['user']['language']) && $context['user']['language'] == $language['filename'] ? ' disabled="disabled" class="langflagbuttonactive" ' ' class="langflagbutton"''>
  <img class="langflag" src="'
$settings['default_theme_url'], '/images/LanguageMenuImg/'$language['filename'], '.png" height="' ,$modSettings['language_menu_icon_height'], '" width="' ,$modSettings['language_menu_icon_width'], '" alt="' ,$language_button'" /></button>
</form>'
;
}
}
// Ok I got it you want normal buttons... is your choice
elseif ($modSettings['language_menu_tamplate'] == 'button_menu')
{
echo $txt['language_menu_select_language'];
foreach ($context['languages'] as $language)
{
$language_button str_replace("-utf8","",$language['name']);
if (isset($custom_label[$language['filename']])) $language_button $custom_label[$language['filename']]; 
echo '
<form action="" method="post">
<input type="hidden" name="languagemenu" value="'
$language['filename'], '" />
<button id="'
$language['filename'], '" type="submit" value="'$language['name'], '"', isset($context['user']['language']) && $context['user']['language'] == $language['filename'] ? ' disabled="disabled" class="active" ' '''>' ,$language_button'</button>
</form>'
;
}
}
// Mmmmm we have a problem here
else echo $txt['language_menu_template_error'];
echo'
</div>'
;
}
// No languages we can find!
elseif (empty ($context['languages']))
echo $txt['language_menu'] . $txt['no_matches'];
// If this occurs we are in trouble.
else
echo $txt['language_menu'] . $txt['error_occured'];
   }
}
?>

any help would be much appreciated
may i add that the error only seems to happen on pages that are loaded through the SSI.php script
for example this page if want to take look
http://usaulnaynatation.site90.com/new/home.php

i've posted this in the support topic a while back but i've still got no answer and the mod creator seems to of not been connected for a while

Kindred

well, I will say that, just because the mod author does not respond - does not make it correct to post mod problems in the SMF support area.

However, that being said, based on the error this is your problem
         updateMemberData($user_info['id'], array('lngfile' => $_POST['languagemenu']));

It seems that something is preventing the full load of user_info....

What code are you using for that external page?

do note, as a guest, I do not see the error until I click on the flag...

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

glennmckenna

Quote from: Kindred on May 04, 2013, 09:40:15 AM
well, I will say that, just because the mod author does not respond - does not make it correct to post mod problems in the SMF support area.

However, that being said, based on the error this is your problem
         updateMemberData($user_info['id'], array('lngfile' => $_POST['languagemenu']));

It seems that something is preventing the full load of user_info....

What code are you using for that external page?

do note, as a guest, I do not see the error until I click on the flag...
yes that is what happens you click on the flag and you get the error
here is the code of the page that i gave you the link to

<?php

$ssi_theme 
4;
 require_once(
'forum/SSI.php');
$context['page_title_html_safe'] = 'home';
if (empty(
$context['html_headers']))
  
$context['html_headers'] = '';

$context['html_headers'] .= '<link href="main.css" rel="stylesheet" type="text/css">';
 


 
template_html_above();
  
template_body_above();

 echo 
'

 
<a class="twitter-timeline"  href="https://twitter.com/aulnaynatation" data-widget-id="282847438883135488">Tweets de @aulnaynatation</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>

<div class="menu-right">
<div class="menu-header" style="width: 300px"><strong>who are we</strong>
<div style="margin-bottom:10px; width: 300px;" class="menu-body">
summer swimming club affiliated<br>to the French Swimming 
Federation.<br>We have many activities some including all the 
family we welcome swimmers of all levels from<br>beginners to 
competitive including<br>non swimmers as these lessons are<br>
also provided form six years plus,<br>we are a part of the 
French National swimming school discover all the benefits, 
enjoyment, fitness, discipline, for everyone of swimming.
</div>
</div>
<div class="menu-header" style="margin-top:15px"><strong>weather<strong>
<div class="menu-body">
<center>
<div id="c_c12b608b55173f57f58a42ecbafb8113" class="alto">
<h2 style="color: #000000; margin: 0 0 3px; padding: 2px; font: bold 13px/1.2 Verdana; text-align: center;"><a href="http://www.meteorama.fr/m%C3%A9t%C3%A9o-aulnay.html" style="color: #000000; text-decoration: none;">meteo a Aulnay</a></h2></div><script type="text/javascript" src="http://www.meteorama.fr/widget/widget_loader/c12b608b55173f57f58a42ecbafb8113"></script>
</center>
</div>
</div>
</div>
<div style="margin:25px 10px" align="center">
<a target="_blank" href="http://charente-maritime.fr/CG17/jcms/j_5/accueil">
<img src="../images/CG 17.jpg" alt="charente marentime" class="logo"/></a>
<a target="_blank" href="http://www.cnds.info/">
<img src="../images/Etat CNDS.JPG" alt="cnds" class="logo"/></a>
<a target="_blank" href="http://www.cdc-aulnay.fr/">
<img src="../images/logo cdc.jpg" alt="conton de aulnay" class="logo"/></a>
<a target="_blank" href="http://www.ffnatation.fr/webffn/index.php">
<img src="../images/logo_ffn.png" alt="ffn" class="logo"/></a>
<a target="_blank" href="http://www.poitou-charentes.fr/accueil.html;jsessionid=853A0918DE3F77AA12AB64DCC193FA02">
<img src="../images/logo-rpc-espritequip.JPG" alt="" class="logo"/></a>
<a target="_blank" href="http://charentemaritime.ffnatation.fr/script/index.php">
<img src="../images/logo FFN issi.gif" alt="logo FFN charente maritime" class="logo" /></a>
<a target="_blank" href="http://poitoucharentes.ffnatation.fr/script/index.php">
<img src="../images/logo ffn poitou charente.jpg" alt="logo ffn poitou charente" class="logo" /></a>
</div>

'
;
  
   
template_body_below();
  
template_html_below();
 
?>



Arantor

You should not call the template functions directly. Call template_header() and template_footer() instead of the raw calls you're making.

glennmckenna

Quote from: Arantor on May 04, 2013, 12:18:21 PM
You should not call the template functions directly. Call template_header() and template_footer() instead of the raw calls you're making.
right fixed that thanks for pointing that out much appreciated

now just to find out how to fix this error
Notice: Undefined index: id in /home/a4787346/public_html/new/forum/Sources/Subs-LanguageMenu.php on line 53

Arantor

Change $user_info['id'] to $context['member']['id']

glennmckenna

Quote from: Arantor on May 04, 2013, 01:23:50 PM
Change $user_info['id'] to $context['member']['id']
ok will do that
may i ask what does that change?

Arantor


glennmckenna

#8
i now get this error
Parse error: syntax error, unexpected T_IF in /home/a4787346/public_html/new/forum/Sources/Subs-LanguageMenu.php on line 1
may i just say that it is like this for all the web site

here is the subs-languagemenu.php in it's current state
<?php

/**

 * Language Menu for SMF (LMSMF)

 *

 * @package LMSMF

 * @author [Marcelo]

 * @2nd-author emanuele

 * @copyright 2012 [Marcelo], Simple Machines

 * @license http://www.simplemachines.org/about/smf/license.php BSD

 *

 * @version 3.0.1

 */

/**********************************************************************************

* LanguageMenu                                                                *

***********************************************************************************

* A modification to show an advanced language menu written for                    *

* SMF: Simple Machines Forum                                                      *

* =============================================================================== *

* Software Version:       LanguageMenu 3.01                                     *

* Software by:            Marcelo Navarrete (http://iluminandoclasicas.com.ar)    *

* Copyright by:           IluminandoClasicsas (http://iluminandoclasicas.com.ar)  *

* Support, News, Updates at: http://www.simplemachines.org                        *

***********************************************************************************



***********************************************************************************

* IMPORTANT!!!!!!:                                                                *

***********************************************************************************

* We kindly ask you to keep the language icon that identify the choose/select     *

* or switch option for languageLanguage Menu.                                     *

* This language icon is an initiative to standardise language selection icon.     *

* If you feel that the size or the default color of the language icon doesn't fit *

* with your theme: at http://www.languageicon.org/index-icon.php you can download *

* any of the language icons free, choose from 61 different colors and styles.     *

* You are using this software for free please help to standarize the              *

* language icon, keeping it in your site. :)                                      *

***********************************************************************************/



if (!defined('SMF'))

die('Hacking attempt...');

    

function 
LanguageMenu_Language_Checks ()

{

    global 
$context$user_info



    
// Language Checking.

if (isset($_POST['languagemenu']))

{

if (empty($context['languages']))

$languages getLanguages();



if (isset($languages[$_POST['languagemenu']]))

{

updateMemberData($context['member']['id'], array('lngfile' => $_POST['languagemenu']));

$user_info['language'] = $_POST['languagemenu'];

$_SESSION['language'] = $_POST['languagemenu'];

}

}

}

   

function 
show_language_menu()

{

global $context$txt$scripturl$modSettings$smcFunc$settings;



//Load language $txt strings

    
loadLanguage('LanguageMenu/LanguageMenu');

    

if ($modSettings['language_menu_activate'] == 1)

{

// Obtain our languages

if (empty($context['languages']))

getLanguages();

// And then our labels 

        
foreach ($context['languages'] as $temp)         

        {

        if (!empty (
$modSettings['lang_menu_label_'.$temp['filename']])) $custom_label [$temp['filename']] = $modSettings['lang_menu_label_'.$temp['filename']];

        }

    
// Do we want custom labels?   

    
if (empty($modSettings['language_menu_activate_custom_labels'])) unset($custom_label);   



// Hopefully We always have something to show  

if (!empty ($context['languages']))

{

echo'

<div id="language_menu">

<img class="langicon" src="'
$settings['default_theme_url'], '/images/LanguageMenuImg/langicon.png" height="16px" width="16px" alt=" " />';

// Do we want a drop language menu?

if ($modSettings['language_menu_tamplate'] == 'drop_menu')

{

echo $txt['language_menu_select_language'], '

<form action="" method="post">

<select id="language_select" name="languagemenu" onchange="this.form.submit()">'
;

foreach ($context['languages'] as $language)

                {

$language_button str_replace("-utf8","",$language['name']);

if (isset($custom_label[$language['filename']])) $language_button $custom_label[$language['filename']]; 

echo '

<option value="'
$language['filename'], '"', isset($context['user']['language']) && $context['user']['language'] == $language['filename'] ? ' selected="selected"' '''>' ,$language_button'</option>';

}

echo'

</select><input type="hidden" name="changelang" value="1" />

<noscript><input type="submit" value="'
$txt['quick_mod_go'], '" /></noscript>

</form>'
;

}

// Or perhaps a nice flag icon menu?

elseif ($modSettings['language_menu_tamplate'] == 'icon_menu')

{

foreach ($context['languages'] as $language)

{

$language_button str_replace("-utf8","",$language['name']);

if (isset($custom_label[$language['filename']])) $language_button $custom_label[$language['filename']]; 

echo '

<form action="" method="post">

<input type="hidden" name="languagemenu" value="'
$language['filename'], '" />

<button id="'
$language['filename'], '" type="submit" value="'$language['name'], '"', isset($context['user']['language']) && $context['user']['language'] == $language['filename'] ? ' disabled="disabled" class="langflagbuttonactive" ' ' class="langflagbutton"''>

  <img class="langflag" src="'
$settings['default_theme_url'], '/images/LanguageMenuImg/'$language['filename'], '.png" height="' ,$modSettings['language_menu_icon_height'], '" width="' ,$modSettings['language_menu_icon_width'], '" alt="' ,$language_button'" /></button>

</form>'
;

}

}

// Ok I got it you want normal buttons... is your choice

elseif ($modSettings['language_menu_tamplate'] == 'button_menu')

{

echo $txt['language_menu_select_language'];

foreach ($context['languages'] as $language)

{

$language_button str_replace("-utf8","",$language['name']);

if (isset($custom_label[$language['filename']])) $language_button $custom_label[$language['filename']]; 

echo '

<form action="" method="post">

<input type="hidden" name="languagemenu" value="'
$language['filename'], '" />

<button id="'
$language['filename'], '" type="submit" value="'$language['name'], '"', isset($context['user']['language']) && $context['user']['language'] == $language['filename'] ? ' disabled="disabled" class="active" ' '''>' ,$language_button'</button>

</form>'
;

}

}

// Mmmmm we have a problem here

else echo $txt['language_menu_template_error'];

echo'

</div>'
;

}

// No languages we can find!

elseif (empty ($context['languages']))

echo $txt['language_menu'] . $txt['no_matches'];

// If this occurs we are in trouble.

else

echo $txt['language_menu'] . $txt['error_occured'];

   }

}

?>

Kindred

ouch...    It looks like you messed up the file with whatever text editor you used. It added extra line feeds on every line, and who know what else it messed up....

I don't know what you used, but your should only ever edit php files with a straight text editor like ConText or NotePad++
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

glennmckenna

Quote from: Kindred on May 05, 2013, 03:50:17 PM
ouch...    It looks like you messed up the file with whatever text editor you used. It added extra line feeds on every line, and who know what else it messed up....

I don't know what you used, but your should only ever edit php files with a straight text editor like ConText or NotePad++
i only use notepad++
so in other words i've got to find a copy of that script then cause it's mucked up i take it ?

Kindred

do you see how the code that you posted looks like it has an extra line between every line of code?
That is indicitive of a bad file edit which changed the unix <CR> to <CR><LF>  (or something like that)
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

glennmckenna

Quote from: Kindred on May 06, 2013, 03:33:08 PM
do you see how the code that you posted looks like it has an extra line between every line of code?
That is indicitive of a bad file edit which changed the unix <CR> to <CR><LF>  (or something like that)
so to fix should i just find the origanel one then?
or should i do some thing else?

Kindred

does the original have the extra lines?  if not, then yes, you can use that...

(although any modifications made to the new one would have ot be re-applied)
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

glennmckenna

Quote from: Kindred on May 06, 2013, 03:48:50 PM
does the original have the extra lines?  if not, then yes, you can use that...

(although any modifications made to the new one would have ot be re-applied)
well if i'm not wrong that is the origanel script that came with the mod so all i could do is redown load the same version of the mod and just overight the faulty one?

glennmckenna

right good news i've fixed he error on line one
but the error on line 53 is still there
Notice: Undefined index: id in /home/a4787346/public_html/new/forum/Sources/Subs-LanguageMenu.php on line 53

here is the code in its actual state
<?php
/**
 * Language Menu for SMF (LMSMF)
 *
 * @package LMSMF
 * @author [Marcelo]
 * @2nd-author emanuele
 * @copyright 2012 [Marcelo], Simple Machines
 * @license http://www.simplemachines.org/about/smf/license.php BSD
 *
 * @version 3.0.1
 */
/**********************************************************************************
* LanguageMenu                                                                *
***********************************************************************************
* A modification to show an advanced language menu written for                    *
* SMF: Simple Machines Forum                                                      *
* =============================================================================== *
* Software Version:       LanguageMenu 3.01                                     *
* Software by:            Marcelo Navarrete (http://iluminandoclasicas.com.ar)    *
* Copyright by:           IluminandoClasicsas (http://iluminandoclasicas.com.ar)  *
* Support, News, Updates at: http://www.simplemachines.org                        *
***********************************************************************************

***********************************************************************************
* IMPORTANT!!!!!!:                                                                *
***********************************************************************************
* We kindly ask you to keep the language icon that identify the choose/select     *
* or switch option for languageLanguage Menu.                                     *
* This language icon is an initiative to standardise language selection icon.     *
* If you feel that the size or the default color of the language icon doesn't fit *
* with your theme: at http://www.languageicon.org/index-icon.php you can download *
* any of the language icons free, choose from 61 different colors and styles.     *
* You are using this software for free please help to standarize the              *
* language icon, keeping it in your site. :)                                      *
***********************************************************************************/

if (!defined('SMF'))
die('Hacking attempt...');
    
function 
LanguageMenu_Language_Checks ()
{
    global 
$context$user_info

    
// Language Checking.
if (isset($_POST['languagemenu']))
{
if (empty($context['languages']))
$languages getLanguages();

if (isset($languages[$_POST['languagemenu']]))
{
updateMemberData($context['member']['id'], array('lngfile' => $_POST['languagemenu']));
$user_info['language'] = $_POST['languagemenu'];
$_SESSION['language'] = $_POST['languagemenu'];
}
}
}
   
function 
show_language_menu()
{
global $context$txt$scripturl$modSettings$smcFunc$settings;

//Load language $txt strings
    
loadLanguage('LanguageMenu/LanguageMenu');
    
if ($modSettings['language_menu_activate'] == 1)
{
// Obtain our languages
if (empty($context['languages']))
getLanguages();
// And then our labels 
        
foreach ($context['languages'] as $temp)         
        {
        if (!empty (
$modSettings['lang_menu_label_'.$temp['filename']])) $custom_label [$temp['filename']] = $modSettings['lang_menu_label_'.$temp['filename']];
        }
    
// Do we want custom labels?   
    
if (empty($modSettings['language_menu_activate_custom_labels'])) unset($custom_label);   

// Hopefully We always have something to show  
if (!empty ($context['languages']))
{
echo'
<div id="language_menu">
<img class="langicon" src="'
$settings['default_theme_url'], '/images/LanguageMenuImg/langicon.png" height="16px" width="16px" alt=" " />';
// Do we want a drop language menu?
if ($modSettings['language_menu_tamplate'] == 'drop_menu')
{
echo $txt['language_menu_select_language'], '
<form action="" method="post">
<select id="language_select" name="languagemenu" onchange="this.form.submit()">'
;
foreach ($context['languages'] as $language)
                {
$language_button str_replace("-utf8","",$language['name']);
if (isset($custom_label[$language['filename']])) $language_button $custom_label[$language['filename']]; 
echo '
<option value="'
$language['filename'], '"', isset($context['user']['language']) && $context['user']['language'] == $language['filename'] ? ' selected="selected"' '''>' ,$language_button'</option>';
}
echo'
</select><input type="hidden" name="changelang" value="1" />
<noscript><input type="submit" value="'
$txt['quick_mod_go'], '" /></noscript>
</form>'
;
}
// Or perhaps a nice flag icon menu?
elseif ($modSettings['language_menu_tamplate'] == 'icon_menu')
{
foreach ($context['languages'] as $language)
{
$language_button str_replace("-utf8","",$language['name']);
if (isset($custom_label[$language['filename']])) $language_button $custom_label[$language['filename']]; 
echo '
<form action="" method="post">
<input type="hidden" name="languagemenu" value="'
$language['filename'], '" />
<button id="'
$language['filename'], '" type="submit" value="'$language['name'], '"', isset($context['user']['language']) && $context['user']['language'] == $language['filename'] ? ' disabled="disabled" class="langflagbuttonactive" ' ' class="langflagbutton"''>
  <img class="langflag" src="'
$settings['default_theme_url'], '/images/LanguageMenuImg/'$language['filename'], '.png" height="' ,$modSettings['language_menu_icon_height'], '" width="' ,$modSettings['language_menu_icon_width'], '" alt="' ,$language_button'" /></button>
</form>'
;
}
}
// Ok I got it you want normal buttons... is your choice
elseif ($modSettings['language_menu_tamplate'] == 'button_menu')
{
echo $txt['language_menu_select_language'];
foreach ($context['languages'] as $language)
{
$language_button str_replace("-utf8","",$language['name']);
if (isset($custom_label[$language['filename']])) $language_button $custom_label[$language['filename']]; 
echo '
<form action="" method="post">
<input type="hidden" name="languagemenu" value="'
$language['filename'], '" />
<button id="'
$language['filename'], '" type="submit" value="'$language['name'], '"', isset($context['user']['language']) && $context['user']['language'] == $language['filename'] ? ' disabled="disabled" class="active" ' '''>' ,$language_button'</button>
</form>'
;
}
}
// Mmmmm we have a problem here
else echo $txt['language_menu_template_error'];
echo'
</div>'
;
}
// No languages we can find!
elseif (empty ($context['languages']))
echo $txt['language_menu'] . $txt['no_matches'];
// If this occurs we are in trouble.
else
echo $txt['language_menu'] . $txt['error_occured'];
   }
}
?>

Arantor

Oh crap, I forgot, that's what burning yourself out on the profile code does to you.

Try $context['user']['id'] rather than $context['member']['id']

glennmckenna

Quote from: Arantor on May 07, 2013, 03:20:56 PM
Oh crap, I forgot, that's what burning yourself out on the profile code does to you.

Try $context['user']['id'] rather than $context['member']['id']
na no luck
here's the error that i get now
Notice: Undefined index: id in /home/a4787346/public_html/new/forum/Sources/Subs-LanguageMenu.php on line 53

Arantor

Oh that's hilarious.

The mod is broken and cannot be fixed without bigger changes because the authors are geniuses.

Specifically, the function that causes this problem occurs before the user has been authenticated, and as such they can never have been identified (which is why you get this undefined error... SMF does not at that point know who the user is)

In fact in the last post before yours in the mod support thread, this very issue was identified!

http://www.simplemachines.org/community/index.php?topic=403078.msg3494188#msg3494188

Remove the mod, the author clearly isn't going to fix it.

Kindred

yeah, that's what I had determined at first from the error and code..   I figured that you might have hit on a workaround - but, it appears that the mod problems are bigger than that.....
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Arantor

Well, there are times that $user_info won't have the information but $context will, and $context['member'] is actually what contains all the user-whose-profile-you're-viewing is (this is because pretty much everything I've done in the last month centred on that rather than $context['user']) but since neither are declared here, there's larger problems.

glennmckenna

Quote from: Kindred on May 07, 2013, 03:49:45 PM
yeah, that's what I had determined at first from the error and code..   I figured that you might have hit on a workaround - but, it appears that the mod problems are bigger than that.....
ok thanks for the help
what sort of work around could i use ?
Bering in mind is that all i need it to do is just allow the user to select the language he/she wants (if possible for the selected language to be remembered) and then it changes the sites language just for that user and not for every one
any help would be great

Arantor

Quotewhat sort of work around could i use ?

-sigh- There isn't one. He was talking to me thinking I'd found a quick solution, which I haven't.

QuoteBering in mind is that all i need it to do is just allow the user to select the language he/she wants (if possible for the selected language to be remembered) and then it changes the sites language just for that user and not for every one

How about searching the mod site? There are at least two other mods that do this exact thing, if not more.

Advertisement: