Closed (outdated)
Project:
User Points
Version:
6.x-1.x-dev
Component:
Code: userpoints
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
22 Apr 2009 at 15:07 UTC
Updated:
24 Feb 2018 at 10:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
frankcarey commentedhmm. not working, i get this passed back out... no txn_id
* description (String, 20 characters ) points from 4.7 site
* display (String, 1 characters ) 0
* moderate (String, 5 characters ) FALSE
* points (String, 2 characters ) 31
* tid (String, 2 characters ) 31
* uid (String, 4 characters ) 1110
* operation (NULL)
* reference (NULL)
* entity_id (NULL)
* entity_type (NULL)
* status (Integer) 1
* expired (NULL)
* parent_txn_id (NULL)
* expirydate (NULL)
Comment #2
frankcarey commentedOK, I see why. We're not using drupal_write_record, so we never know the txn_id of a new record.
I see there has been a few months btw 1.0 and 1.dev, maybe you already did this, but if you didn't how about using drupal_write_record instead?
http://api.drupal.org/api/function/drupal_write_record/6
Comment #3
frankcarey commentedOK, this patch accomplishes both $params being passed by reference, and using drupal write record instead of the insert. so you get the whole txn back (including txn_id) for passing to the post-save hooks, and then passing the final $params object back through the $params argument.
I tested programatically and it worked fine, haven't tried any contrib modules.
Patched against version 6.1.0
Comment #4
frankcarey commentedbump. Can we implement this? It's needed for the integration with the Migrate / Migrate Extras modules.
Comment #5
kbahey commentedPatch no longer applies.
Please re-roll against DRUPAL-6--1 CVS tag.
Comment #6
Brandonian commentedHalf of the previous patch's intent (using drupal_write_record()) has already been applied in Drupal-6--1. This patch fixes the other half of the problem (passing ¶ms by reference), as well as adding another drupal_write_record in _userpoints_update_cache(). Passes all the same Simpletests prior to the patch, but has 3 fewer notices! Woot!
Comment #7
kbahey commentedCommitted.
Thanks.
Comment #8
kbahey commentedThis is causing API problems #786378: Last DEV release incompatible with UserPointsContrib module.
Therefore I am rolling this back.
Comment #9
Brandonian commentedPatch reapplies the drupal_write_record() in _userpoints_update_cache(). Passing $params by reference is a non-issue for me, and since it seems to break contrib, no reason to include it. SimpleTests pass the same as they did with the previous patch (which is two more than without the fix), and enabling userpoints contrib modules doesn't seem to break anything.
Patch also leaves the previous Simpletests, just as a backup in case the reference addition is attempted again.
Comment #10
Brandonian commentedForgot to mark needs review...
Comment #11
kbahey commentedIf 2 people review this and test that it is working with contribs, I will commit it.
Comment #12
Antoine Lafontaine commentedI've submitted a patch here http://drupal.org/node/786382 that I believe would allow patch in #6 to be committed including passing &$params by reference (which I would like to see happen).
Comment #13
berdirBad dreditor always makes these these trailing whitespaces red :)
I don't get this part...
- $points is rand(1, 500), so it can never be NULL?
- The other part just adds both points values to the description, while that might be nice for debugging, isn't necessary?
So, I don't see what's actually being tested here.
Other than that, the actually proposed change looks good to me. While passing $params by reference would be nice, I see why it can break contrib modules. Maybe that's something we can add to the D7 version (Or even make params an object there, the it simply is by reference by default).
Powered by Dreditor.
Comment #14
Fidelix commentedSubscribing...
Comment #15
manuel.adanClosing this as outdated, 6.x version is no longer maintained.