View Full Version : Private Message Function?
KGodel
07-04-2015, 02:06 PM
Hey guys.
I was wondering if there was a PM function in vB or if it would be difficult to build one. We have several custom systems that award users points for certain things and we'd like to be able to generate PMs with that information and send it to those users. Thanks!
x iJailBreak x
07-04-2015, 09:53 PM
Hey guys.
I was wondering if there was a PM function in vB or if it would be difficult to build one. We have several custom systems that award users points for certain things and we'd like to be able to generate PMs with that information and send it to those users. Thanks!
There is, lemme dig out some code I've used in the past.
$message = ""; // pm body
$title = ""; // pm title
$fromid = ""; // userid of pm sender
$toid = ""; // userid to send pm to
$fromuser = fetch_userinfo($fromid);
$tuser = fetch_userinfo($toid);
$uname = $tuser['username'];
$idu = $tuser['userid'];
$to = "$uname";
$id = "$idu";
$pm =& datamanager_init('PM', $vbulletin, ERRTYPE_STANDARD);
$pm->set('fromuserid', $fromuser['userid']);
$pm->set('fromusername', $fromuser['username']);
$pm->set('title', $title);
$pm->set('message', $message);
$pm->set('iconid', 1);
$pm->set('showsignature', 1);
$pm->set('allowsmilie', 1);
$pm->set_recipients($to, $fromuser['permissions']);
$pm->set('dateline', TIMENOW);
$pm->save();
It's a little messy, but it gets the job done. It could be easily implemented into existing code by a developer. :)
KGodel
07-04-2015, 10:14 PM
Thank's mate. Easy enough to create a function for that.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.