Scenario:
I've got a site using Userpoints, Flag, and Rules to create a small digital store. I've got a non-global flag for purchasing digital files, which are assigned a points amount. Rules checks the User's current point amount against the item's cost, and if the user has enough points to buy, gives the user an access link to the file. If the user doesn't have enough points, a message is shown and the node is unflagged.
Checked my Rules debug log, and everything evaluates correctly.
I've got a view set up to display products in a grid, with the flag link shown at the bottom, titled "Buy."
Issues:
In my "Purchase" flag's permission's settings, I ideally want to give all authenticated users (customers) the ability to flag, but not to unflag - they can't return their digital purchases. However, when the unflag permission is unchecked, when users without enough points try to buy something, the node is left as flagged, even though the correct message shows up ("Sorry, you don't have enough points to purchase this item"). And flagged nodes show the download link to the file.
When the unflag permission is checked for authenticated users, the Rules work as expected, and now the unflag link (Return) shows up next to all purchased items - which I don't want! I want it to show the "unflag not allowed" text - "Purchased" in this case.
How can I resolve these conflicting issues? I'm guessing this has to do partially with the Rules side, which asks for "User on whose behalf to flag" with my "Cannot Purchase" rule. But that has to be the flagging user, right?
Comments
Comment #1
somimi commentedThe reason I'm not using Userpoints + Ubercart, by the way, is because *that* set of modules isn't fully functional for making points-based purchases for Drupal 7 yet.
Comment #2
fehin commentedPerhaps, you should uncheck "Permission check" (Whether to check access permissions against the user on whose behalf to flag.) and see if it works.
How did you check if user has enough points. Points condition wasn't available when I used a node was flagged event.
Comment #3
fehin commentedI was wrong, "Permission check" (Whether to check access permissions against the user on whose behalf to flag.) should be checked to bypass the user permission. The naming is wrong according to this thread http://drupal.org/node/1550540. I tried it and it worked.
Comment #4
joachim commentedSounds like this can be closed.