Quote:
Originally Posted by TiKu
To fix the problem, add this code to MN hook:
Code:
if (!function_exists('vsa_CompareVersions'))
{
function vsa_CompareVersions($verstr1, $verstr2)
{
$ver1 = explode('.', $verstr1);
$ver2 = explode('.', $verstr2);
for($i = 0; $i < 3; $i++)
{
if(intval($ver1[$i]) > intval($ver2[$i]))
return -1;
elseif(intval($ver1[$i]) < intval($ver2[$i]))
return 1;
}
return 0;
}
}
Then instead of
Code:
if ($vbulletin->options['templateversion'] >= '4.1.8')
use this code:
Code:
$templateVerIsOlderThan418 = (vsa_CompareVersions($vbulletin->options['templateversion'], '4.1.8') > 0);
if(!$templateVerIsOlderThan418)
|
That's cool you posted the fix but you sort of re-invented the wheel there. PHP has a built in function called "version_compare" that compares versions numbers like x.x.x to y.y.y
http://php.net/manual/en/function.version-compare.php
You just need to replace the old IF conditions with this:
Code:
if (version_compare($vbulletin->options['templateversion'], '4.1.8', 'ge'))
The "ge" means "Greater than or equal to"
Working good for me on 4.1.11 with this change. :up: