10929 Posts in 2613 Topics by 1809 members
|Go to End|
4 September 2009 at 8:33pm
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.
5 September 2009 at 12:28pm
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
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
5 September 2009 at 4:21pm
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.
6 September 2009 at 2:33pm
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
|Go to Top|