User Import and Views fix
so, I had to import hundreds of user profiles from a CSV file and the User import module for Drupal is fantastic.
However, I noticed that when creating a view of the profiles, they were showing up duplicated in the view results. DavidwhThomas posted a fix in the Drupal community on this:
To solve this, temporarily comment out the case ‘insert’: line in profile_user in:
/modules/profile/profile.module line 177
remove the ‘comment out’ after the import
<?php
/**
* Implementation of hook_user().
*/
function profile_user($type, &$edit, &$user, $category = NULL) {
switch ($type) {
case 'load':
return profile_load_profile($user);
case 'register':
return profile_form_profile($edit, $user, $category, TRUE);
case 'update':
return profile_save_profile($edit, $user, $category);
case 'insert':
//return profile_save_profile($edit, $user, $category, TRUE); //comment out this line!
case 'view':
return profile_view_profile($user);
case 'form':
return profile_form_profile($edit, $user, $category);
case 'validate':
return profile_validate_profile($edit, $category);
case 'categories':
return profile_categories();
case 'delete':
db_query('DELETE FROM {profile_values} WHERE uid = %d', $user->uid);
}
}
?> 