MyBB Community Forums

Full Version: Change theme from URL
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi,

I was asking that it's possible to change theme from the url of board.

In vbulletin it's possibile so: url/index.php?style=IDTHEME

I tried also with MyBB but don't work.

I know that exist plugin to change theme but so it's more easy, especially for a preview of theme.

Thanks ~
It'll need a plugin, moved to requests.
Can I use this code?

if ($mybb->input['style']) {
$query = $db->query("UPDATE ".TABLE_PREFIX."users SET style = ".$mybb->input['style']." WHERE uid ='{\$mybb->user['uid']}'");
}

It works but only with registered users, for visitors, how can I do?
Now I modify the code with this:
if (! $mybb->user['uid']) { // controllo che l'utente non sia loggato 
if ($mybb->cookie['style'] == FALSE) { // controllo che non sia presente il cookie style nel computer del visitatore 
$loadstyle = "def='1'"; // se il controllo precedente ha successo, carico il tema di default 
$query = $db->simple_select("themes", "name, tid, properties, stylesheets", $loadstyle, array('limit' => 1)); 
$theme = $db->fetch_array($query);  
if ($mybb->input['style']) { // Se da visitatore inserisco nell'url ?style=IDTEMA 
$style = intval($mybb->input['style']); // do alla variabile style il valore INTERO del get 
my_setcookie("style", $style); // scrivo la variabile nel cookie style 
} 
} else { 
$loadstyle = "def='{$mybb->cookie['style']}'"; // Se il cookie style è presente nel pc del visitatore, setto come tema di default il contenuto del cookie 
$query = $db->simple_select("themes", "name, tid, properties, stylesheets", $loadstyle, array('limit' => 1)); 
$theme = $db->fetch_array($query);  
} 
}  
if ($mybb->user['uid']) { // Se l'utente è loggato estrapolo il valore del campo style della tabella users e lo setto come stile per esso 
$query = $db->query("SELECT style FROM ".TABLE_PREFIX."users WHERE uid='{$mybb->user['uid']}'"); 
$theme = $db->fetch_array($query); 
} 

At line 191-209 of global.php but doesn't work also for logged users.

Any ideas?
Some ideas?
No one?
So? Can nobody help me?
UP please
Nobody can help me?
You could be best of to install this:

http://mods.mybboard.net/view/quick-them...ned-for-14

Personally, I don't see any reason why you would allow theme changes manually through a URL.
I installed this but I would like to do index.php?style=IDTHEME for an easily preview so I can give the directly address for the preview
ex: http://site.ext/mybb/index.php?style=1
Pages: 1 2