Sending a PM
Imran Offline
Member
***
Posts: 204
Joined: Apr 2010
Post: #1
Question Sending a PM
Hello zinga !

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

PHP Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
		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


[Image: logo.png]

[Image: twitter.png]
07-29-2010 04:51 PM
Visit this user's website Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #2
RE: Sending a PM
Are the to/from variables set?

Can't see much from that code, but I haven't really checked either.

My Blog
07-29-2010 06:39 PM
Find all posts by this user Quote this message in a reply
Imran Offline
Member
***
Posts: 204
Joined: Apr 2010
Post: #3
RE: Sending a PM
Yes Yumi these are set in the settings.

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


[Image: logo.png]

[Image: twitter.png]
07-30-2010 04:25 PM
Visit this user's website Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #4
RE: Sending a PM
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?

My Blog
07-30-2010 06:51 PM
Find all posts by this user Quote this message in a reply
Pirata Nervo Offline
Member
***
Posts: 235
Joined: Jan 2008
Post: #5
RE: Sending a PM
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
07-30-2010 07:56 PM
Find all posts by this user Quote this message in a reply
Imran Offline
Member
***
Posts: 204
Joined: Apr 2010
Post: #6
RE: Sending a PM
Thank You ! it is working now

[Image: logo.png]

[Image: twitter.png]
07-31-2010 01:42 PM
Visit this user's website Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: