2009-06-18, 11:30 PM
I know, I know. It's really creative title, right? Anyways, I usually just add my custom code directly into a file (like member.php in this case). However, to make upgrades easier, I'm turing my code into plugins. However, the code that worked in member.php no longer works in the plugin. Instead, I get this SQL error:
Here's the code for the plugin:
Any ideas?
MyBB has experienced an internal SQL error and cannot continue.
SQL Error:
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Query:
UPDATE mybb_users SET registrationParagraph='' WHERE uid=
Here's the code for the plugin:
<?php
// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
$plugins->add_hook("member_do_register_end", "regParagraph_run");
function regParagraph_info()
{
return array(
"name" => "Paragraph to Database",
"description" => "Puts the users registration paragraph into the database.",
"website" => "http://www.thedrp.org/",
"author" => "Nicholas Roge",
"authorsite" => "http://www.thedrp.org/",
"version" => "1.0",
"guid" => "",
"compatibility" => "*"
);
}
function regParagraph_run()
{
global $db;
$usr=$user_info['uid'];
$rP=$db->escape_string($mybb->input['regParagraph']);
$db->query("UPDATE mybb_users SET registrationParagraph='$rP' WHERE uid=$usr");
}
?>
Any ideas?