Drupal7

Drupal 7 - Create a user with custom fields based on Taxonomy terms

Let say we have a travel-website. Each user has fields like :
- My Hometown (single entry)
- Visited cities (multiple entries)
- Cities I want to visit (multiple entries)

And we want to restore user-db from an extern-file. We have to prepare taxonomy terms and assign IDs before starting insert data. After parsing data, we can create each user with following php-code.



$uname = "Alex Miller";
$umail = "alex.miller@example.com";

$hometown_id = 123;
$visited_city1 = 345;
$visited_city2 = 456;

$tovisit_city1 = 678;
$tovisit_city2 = 789;
Syndicate content

CafeWebmaster.com(CW) is a free online community for webdevelopers and beginners. Anybody can share their code, articles, tips, tutorials, code-examples or other webdesign related material on the site. Newbies can submit their questions and reply to existing questions. CW does not guarantee or warrant reliability of code, data and information published on the site. Use the site on your own risk. The site takes no responsibility of direct or indirect loss or any kind of harm to its users. The site also doesn't take responsibility of infected files or source code with any kind of infection or viruses, worms, spywares, malwares, trojan horses. CW reserves the right to edit, move, or delete any of content for any reason.