Log in

View Full Version : one line plugin not working


Nullifi3d
09-04-2005, 02:41 AM
When I submit a new reply I get the following error:
Fatal error: Call to a member function on a non-object in /home/whd/public_html/includes/functions_newpost.php(427) : eval()'d code on line 1
I installed a plugin in newpost_complete. I tried 2 variations of the code:
$db->query("UPDATE user SET available = available + 100 WHERE userid = $bbuserinfo[userid]");
$db->query("UPDATE user SET available = available + 100 WHERE userid = $vbulletin->userinfo[userid]");

Andreas
09-04-2005, 02:47 AM
1) $db is not within the Scope of build_new_post(); $vbulletin is.
2) $bbuserinfo does not exist in vB 3.5
3) You cant use $vbulletin->userinfo within an evaluated String - break out of it or use {}

But it might be a good idea to use userdata_postsave anyway to avaoid an additional Query.

Nullifi3d
09-05-2005, 12:32 AM
1) $db is not within the Scope of build_new_post(); $vbulletin is.
2) $bbuserinfo does not exist in vB 3.5
3) You cant use $vbulletin->userinfo within an evaluated String - break out of it or use {}

But it might be a good idea to use userdata_postsave anyway to avaoid an additional Query.
Thanks for the info. Do you have any other information on this userdata_postsave?

Would it be something like this?
$uid = $vbulletin->userinfo[userid];
$this->query("UPDATE user SET available = available + 100 WHERE userid = $uid");

Andreas
09-05-2005, 03:44 AM
Actually it would be smth. like this in the Datamanager

$this->registry->db->query_write("UPDATE " . TABLE_PREFIX . "user SET available = available + 100 WHERE userid =" . $this->registry->userinfo['userid']);

Nullifi3d
09-05-2005, 02:18 PM
thanks for helping out KirbyDE. Is there any place I can look to see more detailed documentation as to what can be used in which hooks?

Andreas
09-05-2005, 02:37 PM
Yes - the PHP files :)

Nullifi3d
11-08-2005, 08:53 PM
Can you tell me which php file has userdata_postsave hook in it?

Andreas
11-08-2005, 10:19 PM
class_dm_user.php

Nullifi3d
11-09-2005, 10:03 AM
Thank You