Jump to:

5450 Posts in 1672 Topics by 1197 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Client login in for wedding photography website

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

Page: 1
Go to End
Author Topic: 2985 Views
  • Roweena
    Avatar
    Community Member
    28 Posts

    Client login in for wedding photography website Link to this post

    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)??

  • Fuzz10
    Avatar
    Community Member
    786 Posts

    Re: Client login in for wedding photography website Link to this post

    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');

  • Roweena
    Avatar
    Community Member
    28 Posts

    Re: Client login in for wedding photography website Link to this post

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

    2985 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.