title: How can I check whether one's current User Points are negative with the Rules module?
body: <p>My question is pretty straightforward: how can I check whether a user's current amount of User Points is negative with the Rules module? I'd like to create an action that should be activated when the user is granted User Points. The event is set, but I don't know how I can set the condition.</p>
  
  <p><strong>Edit:</strong> I enabled the PHP filter module in order to get the 'Execute custom PHP code' option in my Rule's conditions. (I didn't know that I had to do <a href="https://drupal.org/node/964494" rel="nofollow">this</a> before...) I used this code to check whether the user's User Points are negative:</p>
  
  <pre><code>global $user;
  $num_pts = userpoints_get_current_points($user-&gt;uid, 'all');
  $neg_pts = $num_pts &lt; 0;
  </code></pre>
  
  <p>Unfortunately, it's always evaluated as 'false', even when the amount of User Points is negative. I've also tried this:</p>
  
  <pre><code>$num_pts = userpoints_get_current_points([userpoints-transaction:user]-&gt;uid, 'all');
  $neg_pts = $num_pts &lt; 0;
  </code></pre>
  
  <p>But that didn't work either (same reason). I don't get any error messages in both cases.</p>
  
  <p>Are these code snippets wrong? How does the correct one look like?</p>