| 1 |
<?php
|
| 2 |
// $Id: blog_theme.module,v 1.1 2007/06/05 06:52:10 frjo Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* This module gives users the option of always having their blog displayed using their default theme
|
| 7 |
* using the $custom_theme variable
|
| 8 |
*
|
| 9 |
* This module is designed for 4.7.x compatibility
|
| 10 |
*
|
| 11 |
* This module was developed by various members of the drupal community
|
| 12 |
* and is maintained by Tatonca.
|
| 13 |
*
|
| 14 |
* If you have any ideas/patches or requests, please post them on the drupal.org
|
| 15 |
* site or email us at tatonca_(at)hotmail.com
|
| 16 |
*
|
| 17 |
* I used frontpage.module as a template. Thanks dubs...
|
| 18 |
*
|
| 19 |
*/
|
| 20 |
|
| 21 |
|
| 22 |
/**
|
| 23 |
* blog_theme_menu
|
| 24 |
*
|
| 25 |
* grabs the theme pref from the currently viewd blog's user object and puts in the $custom_theme variable
|
| 26 |
*
|
| 27 |
*/
|
| 28 |
function blog_theme_menu($may_cache) {
|
| 29 |
global $custom_theme;
|
| 30 |
|
| 31 |
if (!$may_cache) {
|
| 32 |
switch(arg(0)) {
|
| 33 |
case 'blog':
|
| 34 |
case 'user':
|
| 35 |
case 'shoutbook':
|
| 36 |
case 'storylink':
|
| 37 |
case 'archive':
|
| 38 |
if ($uid = arg(1)) {
|
| 39 |
$themes = list_themes();
|
| 40 |
$account = user_load(array((is_numeric($uid) ? 'uid' : 'name') => $uid, 'status' => 1));
|
| 41 |
$custom_theme = $account->theme && $themes[$account->theme]->status ? $account->theme : variable_get('theme_default', 'garland');
|
| 42 |
}
|
| 43 |
break;
|
| 44 |
case 'node':
|
| 45 |
if (is_numeric(arg(1))) {
|
| 46 |
$node = node_load(arg(1));
|
| 47 |
if ($node->type == 'blog') {
|
| 48 |
$themes = list_themes();
|
| 49 |
$account = user_load(array('uid' => $node->uid,'status' => 1));
|
| 50 |
$custom_theme = $account->theme && $themes[$account->theme]->status ? $account->theme : variable_get('theme_default', 'garland');
|
| 51 |
}
|
| 52 |
}
|
| 53 |
break;
|
| 54 |
case 'comment':
|
| 55 |
if (arg(1) == 'reply' && is_numeric(arg(2))) {
|
| 56 |
$node = node_load(arg(2));
|
| 57 |
if ($node->type == 'blog') {
|
| 58 |
$themes = list_themes();
|
| 59 |
$account = user_load(array('uid' => $node->uid,'status' => 1));
|
| 60 |
$custom_theme = $account->theme && $themes[$account->theme]->status ? $account->theme : variable_get('theme_default', 'garland');
|
| 61 |
}
|
| 62 |
}
|
| 63 |
break;
|
| 64 |
case 'image':
|
| 65 |
if (is_numeric(arg(2))) {
|
| 66 |
$themes = list_themes();
|
| 67 |
$account = user_load(array('uid' => arg(2),'status' => 1));
|
| 68 |
$custom_theme = $account->theme && $themes[$account->theme]->status ? $account->theme : variable_get('theme_default', 'garland');
|
| 69 |
}
|
| 70 |
break;
|
| 71 |
}
|
| 72 |
}
|
| 73 |
}
|