Shoult style sheets be attached to the master style?
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #4
RE: Shoult style sheets be attached to the master style?
(08-21-2012 06:24 AM)RateU Wrote:  If you want the Admin has an ability to delete it, don't insert it using MyBB Master Style id.

So I will need to query a list of TID of all the themes in the forum, then insert a style sheet in each one? Basicaly this should work, right?:

PHP Code:
1
2
3
4
5
6
7
8
9
10
11
12
$query = $db->simple_select('themes', 'tid');
while($theme = $db->fetch_array($query))
{
	$db->insert_query('themestylesheets', array(
		'name'         => 'ougc_annbars.css',
		'tid'          => (int)$theme['tid'],
		'attachedto'   => '',
		'stylesheet'   => $db->escape_string('/*--content--*/'),
		'lastmodified' => TIME_NOW
	));
	update_theme_stylesheet_list($theme['tid']);
}


(08-21-2012 11:12 AM)ZiNgA BuRgA Wrote:  Up to you really.  I don't think there's any 'friendly' functions for doing this.
If you want to modify global.css, I'd imagine it's just editing it in the DB then updating the cache file (check MyBB's ACP code on how they do it).

PHP Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
$query = $db->simple_select('themestylesheets', 'sid, tid, stylesheet', "name='global.css'");
while($theme = $db->fetch_array($query))
{
	$theme['stylesheet'] .= '/*--content--*/';
	$db->update_query('themestylesheets', array('stylesheet' => $db->escape_string(unfix_css_urls($theme['stylesheet'])), 'lastmodified' => TIME_NOW), "sid='{$theme['sid']}' AND tid='{$theme['tid']}'");

	if(!cache_stylesheet($theme['tid'], 'global.css', $theme['stylesheet']))
	{
		$db->update_query("themestylesheets", array('cachefile' => "css.php?stylesheet={$theme['sid']}"), "sid='{$theme['sid']}'", 1);
	}

	update_theme_stylesheet_list($theme['tid']);
}


That seems a better way to go, now what about those who already installed this, I hate upgrade scripts No

(08-21-2012 11:12 AM)ZiNgA BuRgA Wrote:  That sounds generous, unless the orange is perhaps more brown in colour.
Generally you don't get much (or worthwhile) support for more advanced topics.  Basic stuff typically gets answered well enough.

"very" and "orange" were replacements for other words, no really that kind of guy and was very upset when writing it.

The support team should be able to answer this kind of questions, or at least pretend/try to do so, IMO. It is very frustrating to be bumping your threads to the top for days to notice they don't.

Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
08-21-2012 12:43 PM
Visit this user's website Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
RE: Shoult style sheets be attached to the master style? - Sama34 - 08-21-2012 12:43 PM

 Standard Tools
Forum Jump: