The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Sending a user a pm.
So I made this code,
Code:
$from = 0; $fromname = ''; $title = 'Test PM'; $message = 'this is a test pm'; $sendpermissions = array( pmpermissions => 7, pmsendmax => 0, pmquota => 0, pmthrottlequantity => 0, ); $pmdm = datamanager_init('PM', $vbulletin, ERRTYPE_ARRAY); $pmdm->set('fromuserid', $from); $pmdm->set('fromusername', $fromname); $pmdm->setr('title', $title); $pmdm->set_recipients($vbulletin->userinfo['username'], $sendpermissoins); $pmdm->setr('message', $message); $pmdm->set('dateline', TIMENOW); $pmdm->save(); |
#2
|
|||
|
|||
You've misspelled "$sendpermissions" when you use it in set_recipients, but I'm not sure that's the issue or not. You could call pre_save() and check to see if the array $pmdm->errors is not empty, and if it isn't look at the contents somehow, and hopefully that will tell you the problem.
|
#3
|
|||
|
|||
Nope, I fixed the typo and ran pre_save, and $pmdm->errors was empty. The entry still got put in the the database however only one of the 2 required like before.
This does seem to be a permissions related problem though. However I'm unsure which permissions from the default $permissions are needed, I don't want to use $permissions and pass in the users permissions because the pm is not coming from a user. But when using $permissions it worked as intended. --------------- Added [DATE]1334528266[/DATE] at [TIME]1334528266[/TIME] --------------- So after copying my permissions to $sendpermissions and removing variables one at a time, the only value that needs to be present in the permissions array is the following. Code:
$sendpermissions = array( adminpermissions => 3, ); |
#4
|
|||
|
|||
Yeah, I don't understand what's going on. The only place in class_dm_pm.php that I see it using the adminpermission value is if the sending user is ignored by the recipient, then the adminpermission can override it. But you seem to be setting the from userid to 0 - I'm kind of surprised that even works. Oh well...
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|