1
Jack404
Sending Private Messages (Advanced)
  • 2004/4/27 1:47

  • Jack404

  • Just popping in

  • Posts: 56

  • Since: 2003/5/16


I'm writing a php script that needs to send a message to a user. This is my code:

$message "foo";
$pm_handler =& xoops_gethandler('privmessage');
$pm =& $pm_handler->create();
$pm->setVar("subject""bar");
$pm->setVar("msg_text"$message);
$pm->setVar("to_userid"$uid);
$pm->setVar("from_userid"1);
$pm_handler->insert($pm) or die('Failed to send.');


All my variables used, such as $uid and $message, are correctly set, but every time I try to execute the script, I will consitently get the die message "Failed to send." I don't get any error messages with PHP debug on, serverside enabled E_ALL or XOOPS admin PHP debug enabled.

Have I forgotten something as simple as an include? Not that I can see, but I'd appreciate any help that you folks can lend!

Thanks in advance :)

2
Dave_L
Re: Sending Private Messages (Advanced)
  • 2004/4/27 3:09

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


(advanced reply )

I tried this, got the same symptom, and isolated it to the query failing in XoopsPrivmessageHandler::insert(). If I change the call query() to queryF() in that method, it works.

That probably means that the code needs to be executed as a result of a form submit (POST request method), rather than a URL (GET request method).

Login

Who's Online

177 user(s) are online (105 user(s) are browsing Support Forums)


Members: 0


Guests: 177


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits