Log in

View Full Version : Strange plugin activity


Dean C
07-13-2005, 12:11 PM
// points config
$pointforums = array(2);
$pointcredits = 10;


// do points forums
if(in_array($foruminfo['forumid'], $pointforums))
{
$userdata =& datamanager_init('User', $vbulletin, ERRTYPE_STANDARD);
$userdata->set_existing($vbulletin->userinfo);
$userfields = array(
'field5' => intval(intval($vbulletin->userinfo['field5']) + $pointcredits)
);
$userdata->set_userfields($userfields);
$userdata->save();
}


I have this plugin in the newthread_post_complete hook location. It works fine on localhost but not on my test server (same setup). I've even tried setting field5 to a value of 'moo' but the userfield table is not updated.

Am I missing something here?

P.S. I've already added a die(print_r($userfields)); in there and the array exists, so for some reason the set_userfields isn't working as it should :(

Marco van Herwaarden
07-14-2005, 07:48 AM
And on your life board, the forumid is also '2'?

Are you sure it enters the if-construct?

Dean C
07-14-2005, 07:47 PM
100% positive it enters if the if-construct, because i've put a die('message'); in there. I've also tried setting fields manually like: $userdata->set('posts', 11); and it does that, it just seems to be the set_userfields method that doesn't work :(

merk
07-14-2005, 10:16 PM
100% positive it enters if the if-construct, because i've put a die('message'); in there. I've also tried setting fields manually like: $userdata->set('posts', 11); and it does that, it just seems to be the set_userfields method that doesn't work :(

Is the field editable? (Is it admin editable only and hidden?)

Certain configurations of userfields will not allow you to write a userfield. However! I reported it as a bug and Mike fixed it ! :)

$userdata->set_userfields($userfields, true, 'admin');


:rolleyes:

http://www.vbulletin.com/forum/bugs35.php?do=view&bugid=289

Check out the function definition. You can use admin normal or another one I forget.

Dean C
07-15-2005, 06:39 AM
Gah that fixed it ;) You're a star merk! That method needs to be documented a lot better!