1.8.x

Theme change by Night & Day

Submitted by Flashyx, , Thread ID: 3283

Thread Closed
27-04-2015, 08:16 PM
This post was last modified: 28-04-2015, 02:07 AM by Flashyx
#1
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]

RE: Theme change by Night & Day

#2
any demo or picture?

RE: Theme change by Night & Day

#3
how can i see that ? any live demo?

Users browsing this thread: 4 Guest(s)