Charging UserPoints for flagging a node with Rules in PHP
When you simply want to grant 10 userpoints to a user after flagging a node, you're making things way to complicated! This can be done without custom coding at all. Here's what you have to do:


Create a new rule.
Add an event "A node has been flagged, under YOUR_FLAG".
Add an action "Grant points to a user" and give it an amount of 10.
Done!