Theme change by Night & Day

by Flashyx - 27-04-2015, 08:16 PM
Novice
Posts:
46
Joined:
Apr 2015
Likes:
4
Credits:
372
Reputation:
8
1 Year of Service
#1
OP
Posted: 27-04-2015, 08:16 PM (This post was last modified: 28-04-2015, 02:07 AM by Flashyx.)
Today i show you how change theme when its Day/Night. Its very simply !
First you need to have your 2 themes installed and you need to know the id of your theme.

Now open global.php

Find :
Code:
// This user has a custom theme set in their profile
if(isset($mybb->user['style']) && intval($mybb->user['style']) != 0)
{
$loadstyle = "tid='".$mybb->user['style']."'";
}

Below this code add :

Code:
$time = date("H");
if ($time >= 6 && $time < 18 ) {
$loadstyle="tid='".intval(DAY THEME TID)."'";
} else
{
$loadstyle="tid='".intval(NIGHT THEME TID)."'";
}

Change red content by your IDs.
Tested on 1.8.x can work in 1.6.x (surely) :yus:
[Image: SKxq89B.gif]
Newbie
Posts:
16
Joined:
Nov 2016
Likes:
0
Credits:
0
Reputation:
0
#2
Posted: 05-11-2016, 09:40 PM
any demo or picture?
Lurker
Posts:
7
Joined:
Nov 2016
Likes:
0
Credits:
7
Reputation:
0
#3
Posted: 06-11-2016, 01:06 AM
how can i see that ? any live demo?
The last reply on this thread is older than a month. Please do not unnecessarily bump it.
Register an account or login to reply
Create an account
Create a free account today and start posting right away. It only takes a few seconds.
Login
Log into an existing account.
1 Guest(s)