23368 Posts in 18143 Topics by 2863 members
|Go to End|
9 June 2009 at 6:33am
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
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: http://doc.silverstripe.com/doku.php?id=sqlquery
9 June 2009 at 9:12am
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
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
You can call destory() on any object which I think will handle relations etc.
9 June 2009 at 6:14pm
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
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
Added $member->destroy(); to /cms/code/MemberTableField.php @ line 246 to fix this issue in SilverStripe 2.4.5.
|Go to Top|