PDA

View Full Version : Help on Correcting Code - Userage Permission


Exitilus
03-22-2006, 09:53 PM
I'm trying to correct the code with the following Plugin:

https://vborg.vbsupport.ru/showthread.php?t=93138
Registration Denied if Under 18

The issue is even if you are 18 Today, you have to wait till the end of the month before this plugin will let you register.

So basically you have to be 18 + the remainder of days in the month.

I'm not yet at the expertise needed to fix this, but I believe I've located the part of the code that needs fixing:

if ((($current['year'] - $vbulletin->GPC['year']) < $vbulletin->options['minjoinage']) OR ((($current['year'] - $vbulletin->GPC['year']) == $vbulletin->options['minjoinage']) AND ($vbulletin->GPC['month'] <= $current['month'])))


Just trying to figure out how to correctly set it up so it doesn't do what I stated above. I've tried a few variables but so far no luck....

Some help would be greatly appreciated :)

Cyricx
03-23-2006, 01:22 AM
if ((($current['year'] - $vbulletin->GPC['year']) < $vbulletin->options['minjoinage']) OR ((($current['year'] - $vbulletin->GPC['year']) == $vbulletin->options['minjoinage']) AND ($vbulletin->GPC['month'] <= $current['month']) AND ($vbulletin->GPC['day'] < $current['day'])))


:)

Exitilus
03-23-2006, 03:51 AM
*blink*

After many hours of trying to figure this out with Cyricx STILL having issues. Mainly with the month part not working properly :| We've gotten it to work with "March" .. all the way up to the end of the month. But when the month after starts. It stops working and lets them register all the way up to December 31, 1988.

This is the code Me and cyricx were using. If someone else could try this and figure it out i'd GREATLY appreciate it.

Basically We have been replacing the code in register_checkdate hook

We had to define $current['day'] = date('d'); because it wasn't in register.php

$current['day'] = date('d');
if ((($current['year'] - $vbulletin->GPC['year']) < $vbulletin->options['minjoinage']) OR ((($current['year'] - $vbulletin->GPC['year']) == $vbulletin->options['minjoinage']) AND ($vbulletin->GPC['month'] <= $current['month']) AND ($vbulletin->GPC['day'] > $current['day'])))
{
eval(standard_error(fetch_error('underage_registra tion_denied', $vbulletin->options['minjoinage'])));
}

Andreas
03-23-2006, 04:15 AM
if ((($current['year'] - $vbulletin->GPC['year']) < $vbulletin->options['minjoinage']) OR ((($current['year'] - $vbulletin->GPC['year']) == $vbulletin->options['minjoinage']) AND (($vbulletin->GPC['month'] < $current['month']) OR ($vbulletin->GPC['month'] == $current['month'] AND $current['day'] < $vbulletin->GPC['day']))))

OR

$age = $current['year'] - $vbulletin->GPC['year'];
if ($current['month'] < $vbulletin->GPC['month'] OR ($current['month'] == $vbulletin->GPC['month'] AND date('d') < $vbulletin->GPC['day']))
{
$age--;
}

Exitilus
03-23-2006, 04:34 AM
Hmm... still having issues. The 1st one doesn't work at all. I've been putting it in as


if ((($current['year'] - $vbulletin->GPC['year']) < $vbulletin->options['minjoinage']) OR ((($current['year'] - $vbulletin->GPC['year']) == $vbulletin->options['minjoinage']) AND (($vbulletin->GPC['month'] < $current['month']) OR ($vbulletin->GPC['month'] == $current['month'] AND $current['day'] < $vbulletin->GPC['day'])))
{
eval(standard_error(fetch_error('underage_registra tion_denied', $vbulletin->options['minjoinage'])));
}

The code produces a parse error anytime you try Registering.

and the 2nd code. Trying it by itself or with the

{
eval(standard_error(fetch_error('underage_registra tion_denied', $vbulletin->options['minjoinage'])));
}


part won't let any registration seem to work. Tried a few dates that should of worked and didn't :(

BTW Thanks for responding. It's greatly appreciated :)

Andreas
03-23-2006, 04:53 AM
The code produces a parse error anytime you try Registering.

As always when I post code without actually testing it ... there was one missing ) at the end ;)

Don't know why the alternative doesn't work ... it shoud.
Did you try to output $age?

Exitilus
03-23-2006, 05:58 AM
Now it seems to be working in the opposit direction O.o

Everything From March 24, 2006 to Jan 01, 2006 says your under 18.

Everything After March 24, 2006 works *lol*

These are some of the same things I was getting when working with Cyricx. It's a tough lil bugger

Exitilus
03-24-2006, 05:46 PM
Anyone have any other ideas? :)

Exitilus
03-28-2006, 02:32 AM
None?

Andreas
03-28-2006, 12:16 PM
Works for me.

Exitilus
03-29-2006, 07:58 PM
O.o ...

It must hate me :| *twitch*

This is the exact code i'm trying to use


$current['day'] = date('d');
if ((($current['year'] - $vbulletin->GPC['year']) < $vbulletin->options['minjoinage']) OR ((($current['year'] - $vbulletin->GPC['year']) == $vbulletin->options['minjoinage']) AND (($vbulletin->GPC['month'] < $current['month']) OR ($vbulletin->GPC['month'] == $current['month'] AND $current['day'] < $vbulletin->GPC['day']))))
{
eval(standard_error(fetch_error('underage_registra tion_denied', $vbulletin->options['minjoinage'])));
}

jerx
05-24-2006, 01:56 PM
These codes don' t seem to work. Any other ideas?

Edit: The coppa check is not working correctly, too. According to vB staff this is already fixed in vB 3.6. With that release it might be easier to fix this hack.