MyBB Community Forums

Full Version: Plugin Function Question
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
function test_do()
   global $mybb,$db,$user_info;
		require_once MYBB_ROOT."inc/datahandlers/pm.php";
		$pmhandler = new PMDataHandler();
		$subject = "test";
		$message = "you have been done wooo hahaahahaah";
		$pm = array(
			"subject" => $subject,
			"message" => $message,
			"icon" => -1,
			"toid" => 1,
			"fromid" => $mybb->user['uid'],
			"do" => '',
			"pmid" => ''
		$pm['options'] = array(
			"signature" => "1",
			"disablesmilies" => "0",
			"savecopy" => "0",
			"readreceipt" => "0"

		$pm_errors = $pmhandler->get_friendly_errors();
		$send_errors = inline_error($pm_errors);
		echo $send_errors;
			$pminfo = $pmhandler->insert_pm();

The function/hook is working where it should because if i add echo "test"; to the end it is displaying on the page. Any idea why this doesn't send a PM, no error displayed either.
Does echo $send_errors; echo anything?
No, bit strange! also added

			$pminfo = $pmhandler->insert_pm();
			echo "TEST";

under the insert echo and that echos, so theres no error in the insert, it just doesn't do it!
Search for a PM function I posted on this forum and try it, can't be bothered to search and compare right now Toungue
Just had a search, not finding much.
Found it, let me look!
Just seen your script, how would i run the function, how would the array look..
Simple, just look at how it checks the array inside the function.
You have to pass an uid, a message, a subject and something else. Just check the function Smile