PDA

View Full Version : Hint about pm


MP3
08-10-2005, 10:39 AM
If I want to join two condition in a one line

1)number of posts ( minimum 50 post)
2)user group id =2 ( members group)

To prevent members from sending pm's before 50 post put they have the permission to read any receive pm, is it look like this:

if ($vbulletin->userinfo['posts'] < 20 &$vbulletin->$bbuserinfo['usergroupid'] == '2')
{
print_no_permission();
}



Regards

twoseven
08-10-2005, 12:51 PM
single & is a reference double && is the AND operator

MP3
08-10-2005, 01:12 PM
single & is a reference double && is the AND operator
i did it that way, but i doesn't work :ermm:

any hint ?

twoseven
08-10-2005, 05:01 PM
try
if (($vbulletin->userinfo['posts'] < 20) && ($vbulletin->$bbuserinfo['usergroupid'] == '2'))
{
print_no_permission();
}
if that doesnt work do both conditionals work independently of one another? if not there is an error in the conditional

Andreas
08-10-2005, 05:13 PM
1) & is bitwise AND if used as an Operator
2) It's $vbulletin->userinfo, not $vbulletin->bbuserinfo

MP3
08-10-2005, 05:41 PM
I tried those codes:

if (($vbulletin->userinfo['posts'] < 20) && ($vbulletin->$userinfo['usergroupid'] == '2'))
{
print_no_permission();
}


if (($vbulletin->userinfo['posts'] < 20) & ($vbulletin->$userinfo['usergroupid'] == '2'))
{
print_no_permission();
}


if (($vbulletin->userinfo['posts'] < 20) & ($vbulletin->$bbuserinfo['usergroupid'] == '2'))
{
print_no_permission();
}

if (($vbulletin->userinfo['posts'] < 20) && ($vbulletin->$bbuserinfo['usergroupid'] == '2'))
{
print_no_permission();
}


And no one of them work. :tired:

Andreas
08-10-2005, 05:45 PM
Hmm, where did you put Code #1

MP3
08-10-2005, 05:59 PM
Hook private_newpm_start

Andreas
08-10-2005, 06:09 PM
Once again:

It's $vbulletin->userinfo and not $vbulletin->$userinfo or $vbulletin->$bbuserinfo.

Furthermore, Hook private_newpm_start is not sufficient, as this will keep them form using the Form - but not from sending PMs :)

You must also place the check in private_insertpm_process

MP3
08-10-2005, 06:18 PM
Its work 100%

Thanks alooooot ^_^

twoseven
08-10-2005, 09:46 PM
1) & is bitwise AND if used as an Operator
2) It's $vbulletin->userinfo, not $vbulletin->bbuserinfo
thanks kirby still learning the 3.5 way of doing things myself

& bitwise...forgot about that