Ok, I've hacked in over 11,000 users from Evo into Revo, users and user_attributes. Now I'm trying to get the WebLoginPE extended fields into Revo's Profile extended fields. I've installed the web_user_attributes_extended table into my Revo database, so I can do like so:
$stmt= $modx->query("SELECT * FROM `cms_web_user_attributes_extended`");
if ($stmt) {
// loop through the result set and inspect one row at a time
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
echo $row['internal_key']; // works fine
}
}
Now I had thought to use this loop to load up a user object, get its profile, and use the API to load the four extended fields into the Profile extended field:
$user = $modx->getObject('modUser', array('id'=>$row['internalKey']));
$profile = $user->getOne('Profile');
$fields = $profile->get('extended');
$fields['company'] = $row['company'];
$fields['serial'] = $row['serial'];
$fields['techsupport'] = $row['techsupport'];
$fields['reseller'] = $row['reseller'];
$fields['contract'] = $row['contract'];
$profile->set('extended',$fields);
$profile->save();
This works for the first user, then chokes with the PHP error "...Call to a member function getOne() on a non-object...".
So how can I load the Profile extended field with the four relevant fields from my web_user_attributes_extended table?