Ok, my mistake. It seems that vB5 doesn't have a plugin/hook system like vB4. The hooks you see are template hooks, you need php hooks.
For my addons I use only api extensions
Simple example:
- create in /forum/core/packages a subdir /testimportarray/api
- create a file arr.php
PHP Code:
<?php
if (!defined('VB_ENTRY')) {
die('Access denied.');
}
class TestImportArray_Api_Arr extends vB_Api_Extensions
{
public $product = 'testimportarray';
public $developer = 'testdev';
public $minver = '5.0.0';
public $maxver = '6.0.0 Alpha 1';
public $infourl = '';
public $checkurl = '';
public $AutoInstall = 1;
public $title = 'TestImportArray';
public $version = '1.0.0';
public $extensionOrder = 5;
public static function getArray($prevResult)
{
return [1,2,3,4];
}
}
The subdir name /
testimportarray has to be the same as in class
TestImportArray_Api_Arr and public $product = '
testimportarray';
The subsubdir name /
api is repeated in class TestImportArray_
Api_Arr
The filename
arr.php has to be the same like in class TestImportArray_Api_
Arr
Then check in AdminCP/Add-ons & Hooks/Api Extensions and PHP Hooks if your Api is listed without error
Code:
Add-on: testimportarray
TestImportArray (1.0.0) TestImportArray_Api_Arr Ja 5.0.0 6.0.0 Alpha 1 Ja 5
Then you can use the api function getArray in each template
PHP Code:
{vb:data userIds, arr, getArray}
{vb:debugvardump $userIds}