Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
OK, I moved this out from migrate_points and removed the submodule. I did not add this to hook_migrate_api() because it is still waiting on a userpoints patch from april. If people could help test that and get it committed, we'll test this and finish it up.
#441678: Use drupal_write_record(). Needed to be able to import transactions with migrate_extras
Comment | File | Size | Author |
---|---|---|---|
#17 | userpoints_migrate-689702-17.patch | 6.34 KB | hussainweb |
Comments
Comment #1
mikeryanMoving request to V2.
Comment #2
Fidelix CreditAttribution: Fidelix commented+1.
I'm gonna need this ^^
Comment #3
StuartDH CreditAttribution: 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 CreditAttribution: 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 CreditAttribution: Andrey Zakharov commentedAnd there is no any chance to get this working?
Comment #6
mototribe CreditAttribution: mototribe commentedI ended up writing a custom script that would used the userpoints_userpointsapi() function to "import" the points.
Comment #7
Fidelix CreditAttribution: Fidelix commentedmototribe, can you share?
Comment #8
mototribe CreditAttribution: mototribe commentedComment #9
charliekolev CreditAttribution: 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 CreditAttribution: 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 CreditAttribution: 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::complete
is defined but never called. This results in anycomplete
callback in the migration class itself to not be called.userpoints_txn
table but not updateuserpoints
oruserpoints_total
tables.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.MigrateDestination
classes 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 CreditAttribution: 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