Jump to:

10979 Posts in 2722 Topics by 1815 members

All other Modules

SilverStripe Forums » All other Modules » Email Activation For New Member

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 1675 Views
  • draft
    Avatar
    Community Member
    57 Posts

    Email Activation For New Member Link to this post

    Hi,

    I'm looking for a way to do an activation for a new member sign up in my website. So i believe i will need to add a new column, like a flag status on the member table right, but my question is when i log in (using ss security/login), which page/line of code that i need to modify to confirm that only member have been activated ( 'status=approved') can login to the site.

    Thx.

  • zenmonkey
    Avatar
    Community Member
    528 Posts

    Re: Email Activation For New Member Link to this post

    I just did this, and It can be done two ways. One you Add a Decorator to the Member Object for approval and have all sign up forms write directly to the Member Class. This also means you need to creates a function in your Page.php that does an ApprovedMember Check plus Add a field to your Page Class that only Approved Members Can View.

    A slightly more complex way is to Do your Member Decorator then create a Registration Page with with a DataObjectManager that stores Member Applications and writes them to the Member Class only after they've been approved. This way you can use the standard CurrentMember control in Templates and the Who Can View this Page option in the CMS.

    The attached file require the DataObjectManger Module installed. Hopefully I Didn't screw up the syntax when I Deleted the Site Specific Objects for my site.

    There is a Member Decorator, a Registration Page and DataObjectManager That has an Approval Button.

    You also need to add this line to your _config.php so that your decorator is recognized

    Object::add_extension('Member', 'MemberDecorator');

    These files were made with a lot of help from UncleCheese and willr so I can't take all the credit. Hopefully my in-ellegant code isn't too bad

  • draft
    Avatar
    Community Member
    57 Posts

    Re: Email Activation For New Member Link to this post

    Hi,

    Thx for your help, i got the dataobjectmanager working and i go with your first option. I understand your idea by validating on the page.php if the status of the user is not approved, i can do redirection to the login page or something so they must logged in using the approved user id. But that's not exactly what i want, because on my page, users can open all the page, but just the logged in member will have more feature.

    So what i'm looking here is to do the validation on the login process, so not just checkin useremail and password, but also it will check the status of the approved user, if not approved, they can't do login. Hope you understand what i mean.

    Thx before.

  • zenmonkey
    Avatar
    Community Member
    528 Posts

    Re: Email Activation For New Member Link to this post

    I understand what you're getting at. Unfortunately I couldn't find a way to easily extend the standard Login to check against the ApprovedMember. Hence the use of the DataObjectManager.

    When A User signs up their application is saved in a separate DataObject from the Member Object. So technically they're not a member yet and they can't login. When an admin approves the Application the data is copied from the User Application to the Member Object and allows them to login.

    This way In your template you can wrap any info you don't want the general public to see in the standard <% if CurrentMember %> <% end_if %>

    Basically anything in that if statement is only rendered if the User is Logged in, otherwise its not shown. So everyone can see every page but ONLY Logged in Users Have the Extra Features. PLus you can always include the Standard Member checks into your controllers if you don't want to do it at the template level.

    Hope this was more clear

    1675 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.