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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Adding 'everyone' to a new group

Go to End

4 Posts   1237 Views


Community Member, 244 Posts

7 September 2011 at 10:26am

I've created a new group type called 'newsletter', and I want to add everyone (about 2000 people) to this list (then i'll manually remove the few that don't want to receive newsletters).

Is there an easy way of doing this? I cant seem to see how without going through each person individually...

Ryan M.

Community Member, 309 Posts

7 September 2011 at 12:09pm

You could write a small function within SS that copies the users over and then visit the function's address in the browser to trigger it.


Community Member, 244 Posts

7 September 2011 at 12:45pm

ok, if there is no function within the CMS, i'll probably do it by exporting a CSV file of all the members, opening in excel, removing all the data but the ID, and then importing again into Group_Member table..


Community Member, 215 Posts

7 September 2011 at 2:17pm

Hey - no need for the export you can just do a little function like this:

function MoveGroups(){
	$oldGroupID = "1";
	$newGroupID = "2";
	$oldGroup = DataObject::get_one('Group', "ID = $oldGroupID");
	$newGroup = DataObject::get_one('Group', "ID = $newGroupID");
	foreach ($oldGroup->Members() as $member) {

Then if you set the IDs to be the correct groups and run the function it'll move them over. I haven't actually tested that code so you may need to play with it a lil to get it to work.