This line here:

else {
$query_ttl .= " WHERE points >= :balance";
$args_ttl[':balance'] = $setting['number'];
}

Given there's already a WHERE clause fom WHERE by tid - this can double up on WHERES causing SQL errors.

CommentFileSizeAuthor
#1 userpoints_evaporate-2001226.patch2.61 KBcafuego
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

cafuego’s picture

Status: Active » Needs review
FileSize
2.61 KB

Looks like my logic in that if() block was not actually right at all.

I've redone one of the queries in that section as a db_update() query instead, which will definitely avoid double WHERE errors. However, I don't have an install to test this on over here, so I'll throw a patch on this issue for you to test. Could you please give the patch a try and see if the query still properly lowers the total points for a given points tid?

Bastlynn’s picture

Oh wow! Fast response! :) Sure, absolutely - I'll test this out and see how it handles :) Apologies for the somewhat terse initial issue, i usually try to set up patches but it was that-kinda-day today. :)

cafuego’s picture

Terse? Succinct! :-) I had a spare moment at DrupalCon, so I thought I'd have a poke at a patch :-)

cafuego’s picture

Status: Needs review » Fixed

Tested and changed the '+' into a '-', so the points happily evaporate rather than magically appear ;-)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.