Plugin Function Question
#1
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"
		);
				
		$pmhandler->set_data($pm);

		if(!$pmhandler->validate_pm())
		{
		$pm_errors = $pmhandler->get_friendly_errors();
		$send_errors = inline_error($pm_errors);
		echo $send_errors;
		}
		else
		{
			$pminfo = $pmhandler->insert_pm();
		}
		unset($pm);
		unset($pmhandler);
   
}

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.
Reply
#2
Does echo $send_errors; echo anything?
All my plugins are available for free at MyBB Extend and on my GitHub. MyBB-Plugins.com has been closed and none of my plugins are officially maintained or supported.
Reply
#3
No, bit strange! also added

	
else
		{
			$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!
Reply
#4
Search for a PM function I posted on this forum and try it, can't be bothered to search and compare right now Toungue
All my plugins are available for free at MyBB Extend and on my GitHub. MyBB-Plugins.com has been closed and none of my plugins are officially maintained or supported.
Reply
#5
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..
Reply
#6
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
All my plugins are available for free at MyBB Extend and on my GitHub. MyBB-Plugins.com has been closed and none of my plugins are officially maintained or supported.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)