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

Data Object with Activate and Deactivate password.


3 Posts   339 Views


10 December 2013 at 6:44am Community Member, 15 Posts

Hey guys!, So i have data objects that currently have a "active" attribute that needs a password in order to set the value to true. I am checking the password in the onbeforewrite function. I am needing to add a feature that is going to also use a password to deactivate it. The password to deactivate need to be different then activate password. Im running into all sorts of bugs with this. Anyone have and Ideas on how i can accomplish this? I think im am having a brain jam and need an idea to get me out of it. thanks!


11 December 2013 at 8:56pm Forum Moderator, 5511 Posts

How do you store the password to deactivate it? Is this password the user login password? To check whether a given string matches the users login password, you can do something like the following which takes a string and checks that this is the users password

$password = "Foo";
$member = Member::currentUser();

$result = $member->checkPassword($password);
if($result && $result->valid()) {
return true; // the given string matches the user password.


12 December 2013 at 1:54pm Community Member, 15 Posts

Thanks so much Willr. Very useful information. Any ideas on this subject?

Thanks so much for your help!