PDA

View Full Version : VM question


gamaken
01-05-2013, 10:18 PM
I'm trying to write a plugin to do the following:
When a member attempts to post a VM on another member's profile, the plugin checks -
A) Is your own privacy setting set to only allow friends?
B) Is the recipient of the VM a friend?
If A is true and B is false, the VM is not posted, and the member attempting to post the VM gets an error dialog.

What I've attempted (Hook Location is visitor_message_start):

if (
($vbulletin->options['vm_contactonly'] && !$userinfo['bbuser_iscontact_of_user']
{
standard_error(fetch_error('ban_visitor_message', $vbulletin->userinfo['username']));
}

and:

$novmperm = explode(",", $vbulletin->options['vm_contactonly']);
if (!$userinfo['bbuser_iscontact_of_user' && in_array($vbulletin->userinfo['userid'], $novmperm))
{
standard_error(fetch_error('ban_visitor_message', $vbulletin->userinfo['username']));
}

Neither of the above codes is working. Any ideas?

kh99
01-06-2013, 01:57 PM
It looks like the first one should work, but you have mismatched parentheses (but maybe that's just in the code you posted). If it doesn't work then maybe you should figure out a way to display the values you're checking and make sure they're what you expect (Sometimes I just temporarily throw in echo statements followed by a die(); ).