bzcomputers Well-known member Jun 3, 2024 #2 Go to the files for the addon and look in: src -> addons -> "addon author" -> "addon name" You will find a file named "addon.json" it will include version and additional add-on details. Example:
Go to the files for the addon and look in: src -> addons -> "addon author" -> "addon name" You will find a file named "addon.json" it will include version and additional add-on details. Example:
FoxSecrets Active member Jun 3, 2024 #3 Yes I know this file, but how can I get by code, like getAddonVersion(), something like that, do you know?
Yes I know this file, but how can I get by code, like getAddonVersion(), something like that, do you know?
Chris D XenForo developer Staff member Jun 3, 2024 #4 To get an array of installed add-ons and their versions you can use: PHP: $addons = \XF::app()['addOns'];
To get an array of installed add-ons and their versions you can use: PHP: $addons = \XF::app()['addOns'];
FoxSecrets Active member Jun 3, 2024 #5 I got the error [B]InvalidArgumentException[/B]: Container key 'addOns' was not found in [B]src/XF/Container.php[/B] at line [B]46[/B] Any other way?
I got the error [B]InvalidArgumentException[/B]: Container key 'addOns' was not found in [B]src/XF/Container.php[/B] at line [B]46[/B] Any other way?
Chris D XenForo developer Staff member Jun 3, 2024 #6 Yes, my bad. The correct container key is: PHP: $addons = \XF::app()['addon.cache'];
FoxSecrets Active member Jun 3, 2024 #7 Chris D said: Yes, my bad. The correct container key is: PHP: $addons = \XF::app()['addon.cache']; Click to expand... Great, it worked! Thanks @Chris D
Chris D said: Yes, my bad. The correct container key is: PHP: $addons = \XF::app()['addon.cache']; Click to expand... Great, it worked! Thanks @Chris D
Jeremy P XenForo developer Staff member Jun 4, 2024 #8 You may also use \XF::isAddOnActive('Some/AddOn'). You may optionally pass comparison arguments, or omit them to just get the version ID back.
You may also use \XF::isAddOnActive('Some/AddOn'). You may optionally pass comparison arguments, or omit them to just get the version ID back.