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.

Customising the CMS /

Client login in for wedding photography website


Reply


3 Posts   3138 Views

Avatar
Roweena

Community Member, 28 Posts

6 March 2009 at 8:21am

Edited: 06/03/2009 8:22am

Just wondering if anyone else has done anything similar and how you might achieve this. I need to have a client login option on a wedding photography website. Once a client logs in they will be taken directly to their own private photo gallery page. I've already set up a login area for a single user id and password for a single page on another website as follows:

public function IsCorrectMember(){

$member = Member::currentUser();

if($member->Email == 'video'){
return 1;
} else {
return 0;
}
}

...I'm just not sure how to extend this to match any number of users (to be added by the client via the admin security section) with their own page (also to be created up by the client)??

Avatar
Fuzz10

Community Member, 787 Posts

6 March 2009 at 9:58am

There are probably better solutions , but I'd probably write an extension for the MemberLoginForm Class where you select all the pages that are linked to the currently logged in user and list them...

In pseudo-code , you could probably do something like :

class L8LoginForm extends MemberLoginForm {

function doLogin () {

-perform silverstripe login
-call your own redirector function

}

function yourOwnRedirectorFunction {

- check if the current login is a CMS user and if so --> parent::doLogin() to send them to the CMS backend
- if not , get all pages to which the user is linked and display them

}

}

Good luck !

Note : to tell silverstripe to use your own class instead of it's own ... put this line in the _config.php...
Object::useCustomClass('MemberLoginForm', 'YourCustomClassName');

Avatar
Roweena

Community Member, 28 Posts

10 March 2009 at 3:52am

Thanks! I will give it a go and report back!