Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Migrating a Site to Silverstripe /

What you need to know when migrating your existing site to SilverStripe.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

MIgrating users


Go to End


3 Posts   2734 Views

Avatar
Jarek

Community Member, 30 Posts

19 December 2008 at 9:13am

Hello

How can I add new user from php code? Normally member data are set by calling $form->saveinto($obj). What is the other way to fill member obejct? I have users in file (csv) and I don't know how to do this.

Thx for any help

Avatar
Sigurd

Forum Moderator, 628 Posts

6 January 2009 at 3:59pm

You will need to write PHP to import this for the moment, or SQL, or use the newsletter import and migrate people over as members.

I've added a feature request for what you want, tho: http://open.silverstripe.com/ticket/3303

Avatar
Willr

Forum Moderator, 5523 Posts

8 January 2009 at 8:25pm

You can create members in PHP by going $member = new Member(); then to save the member you just need to call write() on it to write it to the database.

As for the csv import tool you should look on the net for example code but the SS specific stuff is pretty easy.

$member = new Member();
$member->FirstName = "First Name Here";
$member->Surname = "Surname";
// ... you can do Email, or any other fields on member
$member->write(); // save the member