Patch (to be ported)
Project:
User Points
Version:
7.x-2.x-dev
Component:
Code: userpoints
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
19 Jan 2010 at 21:37 UTC
Updated:
1 May 2015 at 22:25 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
mikeryanMoving request to V2.
Comment #2
Fidelix commented+1.
I'm gonna need this ^^
Comment #3
StuartDH commentedFrankcarey, could you link to the April patch that needs testing, if it still needs testing, or are userpoints now ready to go?
Thanks
Stuart
Comment #4
mototribe commentedfrankcarey, that's a patch from April of 2009?! Does that even apply to the D7 version?
Any other way to get the userpoints imported?
thanks
UWE
Comment #5
Andrey Zakharov commentedAnd there is no any chance to get this working?
Comment #6
mototribe commentedI ended up writing a custom script that would used the userpoints_userpointsapi() function to "import" the points.
Comment #7
Fidelix commentedmototribe, can you share?
Comment #8
mototribe commentedComment #9
charliekolev commentedPlease, somebody to help me.
I whant to migrate XML content to custom nodes. It's ok. The question is how to get the id whitch is an atribute.
xml: (i put () instad of angle brackets)
(main)
(aaa id='1')
(bbb)...(/bbb)
(ccc)...(/ccc)
(/aaa)
(/main)
what about:
$item_xpath = '/main/aaa';
$item_ID_xpath = '@id ';
$items_class = new MigrateItemsXML($items_url, $item_xpath, $item_ID_xpath);
also:
$this->map = new MigrateSQLMap($this->machineName,
array(
'id' => array( //****WHAT TO DO WITH THE ID
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
)
),
MigrateDestinationRole::getKeySchema()
);
HEEEELP!
Comment #10
mikeryanMigration support for a contrib module would best go into that module.
Comment #11
derhasi commentedI needed migration support for a project of mine, so I wrote a patch implementing basic migration for Userpoints 1.0
Patch attached ;)
Comment #12
berdirThanks, looks good, can you improve these comments a bit and then I'm happy to commit this.
I'm not exactly sure where this is displayed, be we usually use 'User Points' in user facing strings.
Also, this and the one below should have a simple docblock. According to the current coding standards, that would be Overrides/Implements Class/Interface::method().
I assume this is the implementation of a interface method, then the @params and @return isn't necessary and it should just state Implements ... as described above.
Same for those below.
Comment #13
mxtAny news on this?
Comment #14
marcus178 commentedI have applied this patch but the migration doesn't appear in the Migrate UI. Is there something else that needs doing for this to work?
Comment #15
scottsawyerI am attempting to migrate user points with the method described by @mototribe, but it's not working for me. I am on 7.x-1.0, I have a function that is called in my complete() for the user migration class that ( successfully ) pulls the user's points from my D6 userpoints_txn table, sets the parameters for each record in an array.
However, as soon as I loop over my array of user points and call userpoints_userpointsapi($params), it completely fails. It stops the foreach, gives no error or message.
This is what my setup looks like:
I have attempted to break down my params array to the bear minimum, even just 'uid' and 'points', but it still fails, and fails hard.
I am using very similar code in another module, for scoring Quiz ( I needed some more flexibility for the points ). I use the same params array, the same call to userpoints_userpointsapi($params). I even tried hard coding the values in the array. Nothing works for me.
To summarize, in my custom migration, anytime I call userpoints_userpointsapi(), it completely stops propagation, does not add points, does not pass "Go", does not collect $200. Using 7.x-1.0. Works in other modules.
Any ideas of how I am doing this wrong?
Comment #16
hussainwebThe patch in #11 works, for the most part. I am able to import and rollback userpoints transactions fine with two issues.
MigrateDestinationUserpoints::completeis defined but never called. This results in anycompletecallback in the migration class itself to not be called.userpoints_txntable but not updateuserpointsoruserpoints_totaltables.Both of the issues are fixed in the attached patch.
To address @Berdir's comments in #12:
__toString(): The convention across many of the destination handlers is to use the lowercase representation of the type being imported. e.g. node (article) or comment (comment_node_event) or votingapi.MigrateDestinationclasses is to give a description (since it could be importing anything).Comment #17
hussainwebI'm updating the patch with support to import updates. The previous patch will not process updates correctly, creating new point transactions even for updates.
Comment #18
estoyausenteI used it for migrate 17k of user points in different categories (between two drupal 7 sites) and it run perfectly.
It is my migration code and it worked perfectly:
I tested rollback process and it works ok too.
Comment #19
heddnRTBC yet again.
The example in #17 didn't quite work for me. I'm migrating from a separate D6 source DB. So I used d2d as a dependency and add map_joinable => TRUE to avoid PDO exceptions.
Comment #21
berdirThanks, committed and pushed. Needs to be ported to 7.x-2.x.
Comment #22
berdirComment #23
Media Crumb commented@heddn
Is there anyway you can provide your code as a release? I have a project that requires a migrations from D6 to D7 and Im also using the d2d module along with the d2d UI. Would love any help or guidance on the steps needed to make this happen