PDA

View Full Version : Using the datastore in 3.6.4


thincom2000
01-21-2007, 06:01 PM
I'm trying to use a datastore entry I created (the entry exists in the database in the datastore table) in a foreach() loop, but it tells me I have supplied an invalid argument for foreach()

Database record:
title = my_store
data = a:1:{i:1;s:6:"ITEM";}
unserialize = 1

$vbulletin->my_store = unserialize($vbulletin->my_store);
$store = $vbulletin->mystore;

foreach ($store AS $s)
{
$my_new_array[] = $s;
}

I've looked at tons of other examples from products I have installed and it seems to work fine everywhere else...

Kentaurus
01-21-2007, 07:07 PM
I've looked at tons of other examples from products I have installed and it seems to work fine everywhere else...

Try with this before:


$extrads = array('my_store');
$vbulletin->datastore->fetch($extrads);

// ... then your code


An alternative, is too add it to the $specialtemplates array at the script you are using it.

thincom2000
01-21-2007, 08:09 PM
Setting it in $specialtemplates was the only thing that worked.

Is there a way to put the following in a plugin so that it will work?

$specialtemplates[] = 'my_store';

Kentaurus
01-21-2007, 08:20 PM
Sadly we still don't have an "easy" way to do it. But read this thread for a solution:
https://vborg.vbsupport.ru/showthread.php?t=111882

thincom2000
01-21-2007, 08:58 PM
I hope they make it easier for 3.7

I may as well just use $vbulletin->options in this case.