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.

General Questions

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

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

Completely Delete a Member


8 Posts   2327 Views


9 June 2009 at 6:33am Community Member, 5 Posts

Hy there

I'm asking myself how i can completely delete a Member. If i remove a Member in the Security Group of the CMS it is only removed from the Group but the Member itself still exists.
I plan to build a sort of social networking site and if a Member wish to delete himself (or i wish to delete a member) this should not be a problem at all.

How can i do this (basic) task in SilverStripe?


9 June 2009 at 8:09am Community Member, 901 Posts

Hi Gargo

You could always use a SQL Query to delete the dataset you want. Something like this:

$query = new SQLQuery('*', array('Member'), 'ID = ' . $MemberId);
$query->delete = true;

Where $MemberId is your Member-ID. For further information about the SQLQuery Class, read here:


9 June 2009 at 9:12am Community Member, 5 Posts

thank you for your reply.

seems to be a bad solution cause in this case relations aren't handled correctly. or did i miss something?
furthermore i'm looking for a way to delete Members in the CMS (as easy as i can add them).

maybe the delete() Method on the Member object would do it?

a member based administration interface like "Security" would be nice.


9 June 2009 at 10:31am Community Member, 901 Posts

I'm not sure where the Member is referenced elsewhere. AFAIK only groups are being referenced for permissions, and since you're already removing the member from the group this shouldn't be too much of a problem. I could be wrong though.
Maybe you can extend/modify the SecurityAdmin class to fit your needs?


9 June 2009 at 5:45pm Forum Moderator, 5511 Posts

You can call destory() on any object which I think will handle relations etc.


9 June 2009 at 6:14pm Community Member, 5 Posts

Shouldn't this feature get it's way into the standard implementation of silverstripe?
I think this is a basic administration task which shouldn't be made by each one itself.


15 June 2009 at 3:19am Community Member, 5 Posts

I just tried it out to manage the Member deletion with a ModelAdmin implementation.
Relations are ignored. For example the Records in the Group_Members Table will be keept alive ...
Maybe i have to decorate the onBeforeDelete Function by myself ...


21 September 2011 at 9:48pm Community Member, 150 Posts

Added $member->destroy(); to /cms/code/MemberTableField.php @ line 246 to fix this issue in SilverStripe 2.4.5.