The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Help me wih a variable
hello, Please help me, I need a small plugin to utilize PHP's date functions on the user's birthday to use this code in template FORUMHOME
Code:
<if condition="$bbuserinfo[age] > 15"> show for users > 15 years </if> |
#2
|
||||
|
||||
Put this into a plugin:
PHP Code:
Code:
<if condition="$correct_age"> Show this! </if> |
#3
|
|||
|
|||
Hello Dismounted, thank you for your replying
But I tried in FORUMHOME and for users <15 years or >15 years still shows this code. Is there a problem? I created hooks forumhome_complete. Please help me again. thank you |
#4
|
||||
|
||||
Have a look at this, if you need something more precise:
Code:
function bfrMin($foo, $bar) { $foo = $foo == '' ? '00-00-0000' : $foo; $bday = explode('-', $foo); $year = vbdate('Y', TIMENOW, false, false); $month = vbdate('n', TIMENOW, false, false); $day = vbdate('j', TIMENOW, false, false); if ($year > $bday[2] AND $bday[2] != '0000') { $age = $year - $bday[2]; if ($month < $bday[0] OR ($month == $bday[0] AND $day < $bday[1])) { $age--; } }else{ return 0; } return $age >= $bar ? 2 : 1; } $bar must contain a minimum age. So, this: bfrMin('01-01-1989', 15) Would return 0 if the user hasn't supplied a birthday to vBulletin, 1 if the user is younger than 15 years, or 2 if the user is 15 years old or older. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|