I have encountered a problem when pulling data from a language file.
<if $GLOBALS['mybb']->user['usergroup'] == 1 then>{$lang->online_note}<else>{$lang->online_note2}</if>
In the example above, all "asterix" types of code (such as {1} for a number) is shown as it's shown in the language file rather than it's practical counter-part (a number from the database in the case of {1}), but only for the first hook. The hook after <else> converts {1} etc as it should when viewing the page in a browser. I suspect this has something to do with language files already using PHP, but why is then only the hook before <else> affected and not the one after?
Edit: I'm not sure, but could this problem be due to the fact that i simply copied the online_note hook and made a second one just below it in the language file in question? Do i have to do something more than copy and change the name of a hook in a language file in MyBB for it to properly convert asterisk code?
Edit 2: As i feared, this seems to be an issue with MyBB itself. Apparently, you cannot simply copy an entry in a language file and expect the copy to convert asterisks. I found this code in index.php:
$lang->online_note = $lang->sprintf($lang->online_note, my_number_format($onlinecount), $onlinebit, $mybb->settings['wolcutoffmins'], my_number_format($membercount), $memberbit, my_number_format($anoncount), $anonbit, my_number_format($guestcount), $guestbit);
eval("\$whosonline = \"".$templates->get("index_whosonline")."\";");
Copying this code and changing the first part from online_note to online_note2 did however cause another problem. They both convert asterisks properly, but the copy looks exactly like the original; as if you they were using the same text in the language file. I have no idea how to fix this problem or if the author of this plugin does either.
<if $GLOBALS['mybb']->user['usergroup'] == 1 then>{$lang->online_note}<else>{$lang->online_note2}</if>
In the example above, all "asterix" types of code (such as {1} for a number) is shown as it's shown in the language file rather than it's practical counter-part (a number from the database in the case of {1}), but only for the first hook. The hook after <else> converts {1} etc as it should when viewing the page in a browser. I suspect this has something to do with language files already using PHP, but why is then only the hook before <else> affected and not the one after?
Edit: I'm not sure, but could this problem be due to the fact that i simply copied the online_note hook and made a second one just below it in the language file in question? Do i have to do something more than copy and change the name of a hook in a language file in MyBB for it to properly convert asterisk code?
Edit 2: As i feared, this seems to be an issue with MyBB itself. Apparently, you cannot simply copy an entry in a language file and expect the copy to convert asterisks. I found this code in index.php:
$lang->online_note = $lang->sprintf($lang->online_note, my_number_format($onlinecount), $onlinebit, $mybb->settings['wolcutoffmins'], my_number_format($membercount), $memberbit, my_number_format($anoncount), $anonbit, my_number_format($guestcount), $guestbit);
eval("\$whosonline = \"".$templates->get("index_whosonline")."\";");
Copying this code and changing the first part from online_note to online_note2 did however cause another problem. They both convert asterisks properly, but the copy looks exactly like the original; as if you they were using the same text in the language file. I have no idea how to fix this problem or if the author of this plugin does either.