How can i auto switch forum according to theme tid?
#1
Hello, please can i have a javascript else statement that i can add to mybb global.php that auto switch forum theme according to tid of the theme?
Reply
#2
Use the XTheme plugin, it allows you to do this
https://community.mybb.com/mods.php?acti...w&pid=1388

Regards
WallBB
Reply
#3
(2021-07-12, 03:16 AM)WallBB Wrote: Use the XTheme plugin, it allows you to do this
https://community.mybb.com/mods.php?acti...w&pid=1388

Regards
WallBB

I have been following all your thread supports and release and i must say that you're genius.



Please my request is that, i need the function to work automatically because i have 2 theme on one mybb forum classifying each theme as my mobile and desktop theme (ps. i dont want to us mybb gomobile plugin)
Reply
#4
(2021-07-12, 04:56 AM)The pwince Wrote:
(2021-07-12, 03:16 AM)WallBB Wrote: Use the XTheme plugin, it allows you to do this
https://community.mybb.com/mods.php?acti...w&pid=1388

Regards
WallBB

I have been following all your thread supports and release and i must say that you're genius.



Please my request is that, i need the function to work automatically because i have 2 theme on one mybb forum classifying each theme as my mobile and desktop theme (ps. i dont want to us mybb gomobile plugin)

Yes, I already understand your request, you will need to use the above plugin to allow changing theme using theme id.
By default, you will not be able to redirect your users to a particular theme link.

Now there are multiple ways to redirect your website depending on user agent.

One simple method could be this

if( /Android|iPhone|webOS|iPad|iPod|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
    window.location = "YOUR_MOBILE_THEME_LINK"; 
}

Or you can also use Mobile redirection library's that will redirect to your mobile link
https://github.com/sebarmeli/JS-Redirection-Mobile-Site

Regards
WallBB
Reply
#5
(2021-07-12, 03:00 PM)WallBB Wrote:
(2021-07-12, 04:56 AM)The pwince Wrote:
(2021-07-12, 03:16 AM)WallBB Wrote: Use the XTheme plugin, it allows you to do this
https://community.mybb.com/mods.php?acti...w&pid=1388

Regards
WallBB

I have been following all your thread supports and release and i must say that you're genius.



Please my request is that, i need the function to work automatically because i have 2 theme on one mybb forum classifying each theme as my mobile and desktop theme (ps. i dont want to us mybb gomobile plugin)

Yes, I already understand your request, you will need to use the above plugin to allow changing theme using theme id.
By default, you will not be able to redirect your users to a particular theme link.

Now there are multiple ways to redirect your website depending on user agent.

One simple method could be this

if( /Android|iPhone|webOS|iPad|iPod|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
    window.location = "YOUR_MOBILE_THEME_LINK"; 
}

Or you can also use Mobile redirection library's that will redirect to your mobile link
https://github.com/sebarmeli/JS-Redirection-Mobile-Site

Regards
WallBB

Thanks for the code but can you please explain how i can get mybb theme link and also explain the Xtheme plugin like how do i set it up after activating the plugin since i can't find it.
Reply
#6
(2021-07-12, 10:35 PM)The pwince Wrote:
(2021-07-12, 03:00 PM)WallBB Wrote:
(2021-07-12, 04:56 AM)The pwince Wrote:
(2021-07-12, 03:16 AM)WallBB Wrote: Use the XTheme plugin, it allows you to do this
https://community.mybb.com/mods.php?acti...w&pid=1388

Regards
WallBB

I have been following all your thread supports and release and i must say that you're genius.



Please my request is that, i need the function to work automatically because i have 2 theme on one mybb forum classifying each theme as my mobile and desktop theme (ps. i dont want to us mybb gomobile plugin)

Yes, I already understand your request, you will need to use the above plugin to allow changing theme using theme id.
By default, you will not be able to redirect your users to a particular theme link.

Now there are multiple ways to redirect your website depending on user agent.

One simple method could be this

if( /Android|iPhone|webOS|iPad|iPod|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
    window.location = "YOUR_MOBILE_THEME_LINK"; 
}

Or you can also use Mobile redirection library's that will redirect to your mobile link
https://github.com/sebarmeli/JS-Redirection-Mobile-Site

Regards
WallBB

Thanks for the code but can you please explain how i can get mybb theme link and also explain the Xtheme plugin like how do i set it up after activating the plugin since i can't find it.
It is written in the Xtheme details (https://community.mybb.com/mods.php?acti...w&pid=1388)

XTheme allows you to change your themes with links like example.com/index.php?action=xtheme&style=themeID

ThemeID is your themeID
Reply
#7
(2021-07-13, 04:10 AM)WallBB Wrote:
(2021-07-12, 10:35 PM)The pwince Wrote:
(2021-07-12, 03:00 PM)WallBB Wrote:
(2021-07-12, 04:56 AM)The pwince Wrote:
(2021-07-12, 03:16 AM)WallBB Wrote: Use the XTheme plugin, it allows you to do this
https://community.mybb.com/mods.php?acti...w&pid=1388

Regards
WallBB

I have been following all your thread supports and release and i must say that you're genius.



Please my request is that, i need the function to work automatically because i have 2 theme on one mybb forum classifying each theme as my mobile and desktop theme (ps. i dont want to us mybb gomobile plugin)

Yes, I already understand your request, you will need to use the above plugin to allow changing theme using theme id.
By default, you will not be able to redirect your users to a particular theme link.

Now there are multiple ways to redirect your website depending on user agent.

One simple method could be this

if( /Android|iPhone|webOS|iPad|iPod|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
    window.location = "YOUR_MOBILE_THEME_LINK"; 
}

Or you can also use Mobile redirection library's that will redirect to your mobile link
https://github.com/sebarmeli/JS-Redirection-Mobile-Site

Regards
WallBB

Thanks for the code but can you please explain how i can get mybb theme link and also explain the Xtheme plugin like how do i set it up after activating the plugin since i can't find it.
It is written in the Xtheme details (https://community.mybb.com/mods.php?acti...w&pid=1388)

XTheme allows you to change your themes with links like example.com/index.php?action=xtheme&style=themeID

ThemeID is your themeID

From the sample link you gave for xtheme, I tried it and it works but my main problem is detecting mobile and desktop version the user is using and automatically show them respectively of the browser user agent, okay I tried the code you gave but it didn't work rather is dynamically refreshing the page or it didn't work, please any help to show user theme id base on browser? 


Thanks in addy
Reply
#8
(2021-07-13, 07:38 AM)The pwince Wrote:
(2021-07-13, 04:10 AM)WallBB Wrote:
(2021-07-12, 10:35 PM)The pwince Wrote:
(2021-07-12, 03:00 PM)WallBB Wrote:
(2021-07-12, 04:56 AM)The pwince Wrote: I have been following all your thread supports and release and i must say that you're genius.



Please my request is that, i need the function to work automatically because i have 2 theme on one mybb forum classifying each theme as my mobile and desktop theme (ps. i dont want to us mybb gomobile plugin)

Yes, I already understand your request, you will need to use the above plugin to allow changing theme using theme id.
By default, you will not be able to redirect your users to a particular theme link.

Now there are multiple ways to redirect your website depending on user agent.

One simple method could be this

if( /Android|iPhone|webOS|iPad|iPod|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
    window.location = "YOUR_MOBILE_THEME_LINK"; 
}

Or you can also use Mobile redirection library's that will redirect to your mobile link
https://github.com/sebarmeli/JS-Redirection-Mobile-Site

Regards
WallBB

Thanks for the code but can you please explain how i can get mybb theme link and also explain the Xtheme plugin like how do i set it up after activating the plugin since i can't find it.
It is written in the Xtheme details (https://community.mybb.com/mods.php?acti...w&pid=1388)

XTheme allows you to change your themes with links like example.com/index.php?action=xtheme&style=themeID

ThemeID is your themeID

From the sample link you gave for xtheme, I tried it and it works but my main problem is detecting mobile and desktop version the user is using and automatically show them respectively of the browser user agent, okay I tried the code you gave but it didn't work rather is dynamically refreshing the page or it didn't work, please any help to show user theme id base on browser? 


Thanks in addy

Hey,
Can you share how you added the code and which template you added the code to?
Also, did you try the js code I gave or also the redirection library?

Also share your website url so that I can check it live.
Reply
#9
(2021-07-13, 10:23 AM)WallBB Wrote: [quote pid="1368924" dateline="1626149421"]
[quote pid="1368922" dateline="1626129343"]
[quote pid="1368921" dateline="1626102056"]

if( /Android|iPhone|webOS|iPad|iPod|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
    window.location = "YOUR_MOBILE_THEME_LINK"; 
}

Or you can also use Mobile redirection library's that will redirect to your mobile link
https://github.com/sebarmeli/JS-Redirection-Mobile-Site

Regards
WallBB

Thanks for the code but can you please explain how i can get mybb theme link and also explain the Xtheme plugin like how do i set it up after activating the plugin since i can't find it.
[/quote]
It is written in the Xtheme details (https://community.mybb.com/mods.php?acti...w&pid=1388)

XTheme allows you to change your themes with links like example.com/index.php?action=xtheme&style=themeID

ThemeID is your themeID
[/quote]

From the sample link you gave for xtheme, I tried it and it works but my main problem is detecting mobile and desktop version the user is using and automatically show them respectively of the browser user agent, okay I tried the code you gave but it didn't work rather is dynamically refreshing the page or it didn't work, please any help to show user theme id base on browser? 


Thanks in addy


Hey,
Can you share how you added the code and which template you added the code to?
Also, did you try the js code I gave or also the redirection library?

Also share your website url so that I can check it live.
[/quote]



@wallbb sorry for late reply, i added the code on global.php as
if( /Android|iPhone|webOS|iPad|iPod|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
    window.location = "YOUR_MOBILE_THEME_LINK"; 
}

it didn't work so i added it on header and footer template as
<script> if( /Android|iPhone|webOS|iPad|iPod|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
    window.location = "YOUR_MOBILE_THEME_LINK"; 
} 
</script>
it didn't work.



well my forum site is still on designed mode but you can access it here, please use Desktop to browse in other to see mybb link while mobile phone is not mobile friendly yet in terms of width.
Reply
#10
It is not needed to use plugins for this, just go to forums and set the style for it, if i am not wrong i have seen that setting into admin cp inside forums, so you can select styles for each forums you have...

I have not tested it neither but i think i have used in the past on a friends forum and all goes fine...
The only infinite thing is the universe and human stupidity, but the universe is not for sure

Plugins 1.6.x

Plugins 1.8.x

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)