Quantcast
Channel: Recent posts across whole site
Viewing all articles
Browse latest Browse all 49197

How to import custom fields along with standard fields for users and/or nodes.

$
0
0

Doing a migration to Drupal 7 from another CMS and trying to import content and users. Can import basic fields just fine, but custom fields aren't working. Tried two ways: direct to MySql database and using drupal cmds.

(1) using sql insert

"INSERT INTO users (name, mail, uid, pass, ...) VALUES (blah, blah, blah, blah, ...), (...); " -- works great. able to login with old user id and password (pass is pre-hashed by Drupal routine).

"INSERT INTO field_data_field_display_name (field_display_name_value, entity_type, bundle, entity_id, revision_id, delta) VALUES (...); " -- insert for custom field "display_name" -- does not work, but if I inspect the table entry right after insert stmt and again after logging in and setting the variable through drupal, the entries are identical.

It appears that entering the custom field value through Drupal, sets the table value AND caches the value elsewhere. That caching (if that is what is happening) is not being done with the SQL inserts. I tried clearing the cache with Drupal, but didn't seem to work. Also tried adding to revisions tables as well.

(2) using php/drupal

$entry = array("name"=>"blah", "pass"=>"blah", ..., "display_name"=>"blah");
createUserAccount($entry);

Again, the user account is created, but the custom field entries are not.

HOW DO I import the custom fields? Thanks.


Viewing all articles
Browse latest Browse all 49197

Trending Articles