change the theme automatically when the language changes (MyBB Version 1.8.15)
#1
Hi mybb community
This is my first post and I would like to put this topic to be useful for anyone who wants to change the theme automatically when the language changes from the Quick Language selection box at the bottom of the forum.
[Image: 101.png]


This change was made to the version (MyBB Version 1.8.15)
I don't know about the previous versions, Maybe you can apply the same method.


1 - Open the "global.php" file in the root path

2 - Find the sentence "// Run global_start plugin hook now that the basics are set up"
     You'll find it near line number 100.
// Run global_start plugin hook now that the basics are set up
$plugins->run_hooks('global_start');
if(function_exists('mb_internal_encoding') && !empty($lang->settings['charset']))
{
	@mb_internal_encoding($lang->settings['charset']);
}


3 - Add this code directly after the code that I mentioned above.
// This Style Depends on the language chosen by the user
if($mybb->settings['bblanguage'] == 'english')
{
	$mybb->user['style'] = 2;
}
else
{
	$mybb->user['style'] = 4;
}
( 2 and 4 ) are the theme numbers.


4 - Save your changes, that's it.


[Image: 102.png]

Or You can find the theme number through the link when you point to the name of the theme.

[Image: 103.png]


Because I use both English and Arabic language.
In English, the theme should be from left to right.
Arabic is the opposite, from right to left.
So I have to change the theme according to the user's choice.

Please if i did something wrong, correct me.
For me, everything works perfectly.

I hope this post is useful to someone.
Thanks Mybb.
Reply
#2
I haven't tested this but can see a really good use of this.

Good work Wink
Reply
#3
such a good work i will sure test this as my forum is non english
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)