Log in

View Full Version : Get $specialtemplates via plugins?


Milad
02-08-2006, 04:36 AM
Hi I'm coding a hack that appears in everypage and using datastore table.

I cann't get the serialized data via plugins.

it doesn't seem to be any chance to merge two $specialtemplates arrays

what do you know about that?

have you any idea?

I have one that to modify global.php and add:

$specialtemplates = array_merge($specialtemplates, array('milad'));

but I want to do this via plugin
???????????????

Rich
02-08-2006, 10:54 AM
Hello,

I am fairly new to this, so I may be wrong, but wouldn't that be:


$specialtemplates = array(
'milad',
);


You can add as many entries as you like by adding a new line below the first template listed in the array. It would look like this:


$specialtemplates = array(
'milad',
'another',
'another1',
);

Andreas
02-08-2006, 11:20 AM
You can't load datastore items through Plugins, as the Plugin-System is initialized after datastore items are loaded.

Paul M
02-08-2006, 01:16 PM
Why can't you just use $vbulletin->datastore->fetch() then ?

Milad
02-09-2006, 02:35 AM
I had been forced to use a single query, but really I'm not happy with this.

Thank you All

Dear Andreas
I'll ask in vb.com to get Plugin-System initialized before datastore items are loaded.

merk
02-09-2006, 02:45 AM
Why can't you just use $vbulletin->datastore->fetch() then ?
You can seriously break your forum if you use that function.

http://www.vbulletin.com/forum/bugs35.php?do=view&bugid=1390

Milad
02-09-2006, 02:47 AM
Yes I read it, so I avoid it and use a single query.

Paul M
02-09-2006, 03:06 AM
You can seriously break your forum if you use that function.

http://www.vbulletin.com/forum/bugs35.php?do=view&bugid=1390Surely that depends on where you call it. It you put the fetch in init_start or global_start than no datastore items should have been altered.

merk
02-09-2006, 03:13 AM
I tried using it in global_start, it failed miserably.

Might work in init_start, but be aware the fetch() function will re-fetch certain items no matter what happens.

Milad
02-09-2006, 04:53 AM
I can merge the new item with the old ones and re-fetch, I think it won't do any harm.

what do you think?

merk
02-09-2006, 05:03 AM
I had far too many problems when using fetch() - its easier to write your own function to get datastore items until Jelsoft come up with a solution.