MyBB Hacks

Full Version: Sending a PM
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello zinga !

I am using the following function to sends out a PM.

PHP Code:
		require_once MYBB_ROOT."inc/datahandlers/pm.php";
		$pmhandler = new PMDataHandler();

		$pm = array(
		'subject' => "Your thread has been stucked !",
		'message' => "Hello ! a one of your thread has been stucked successfully. Its an automated Private Message, so please don't reply to it. Thank You",
		'icon' => '',
		'toid' => $thread['uid'],
		'fromid' => $pmsender,
		"do" => '',
		"pmid" => '',
	
	);
	
	$pm['options'] = array(
	'signature' => '1',
	'savecopy' => '1',
	'disablesmilies' => '0',
	'readreceipt' => '0',
	);
	
	
	$pmhandler->set_data($pm);
	$valid_pm = $pmhandler->validate_pm();
	
		if( $valid_pm)
		{
			$pmhandler->insert_pm();
		}


and it is hooked to.

PHP Code:
moderation_start


But it comes up empty ! Ouch

Are the to/from variables set?

Can't see much from that code, but I haven't really checked either.
Yes Yumi these are set in the settings.

PHP Code:
	$pmsender = $mybb->settings['pm_sent_from'];

Sorry, don't have the time to really check everything, but are you sure that "toid" is meant to be set?  private.php doesn't seem to do so.
Double check and see what private.php does.  Also, try tracing your code - for example does it validate?
Take a look at my NewPoints plugin, there's a send PM function there. Use it (if you want) and compare it with this one
Thank You ! it is working now
Reference URL's