History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: BLOJSOM-162
Type: New Feature New Feature
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: David Czarnecki
Reporter: David Czarnecki
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
blojsom

Integrate Registration & View User Properties Plugins

Created: 23/Oct/06 10:10 PM   Updated: 17/Feb/07 01:25 PM
Component/s: blojsom plugins
Affects Version/s: blojsom 3.0
Fix Version/s: blojsom 3.1

Browser: N/A
Application Server: N/A
JDK Version: N/A
O/S Version: N/a


 Description  « Hide
via Eric Broyles:

I wrote a RegistrationPlugin to enable self-service account creation. This is useful if running a blog that requires users to have an account in order to read or comment. Briefly, here's how to use this plugin.
Add the following to the resourceBundlesToLoad list defined on the resourceManager bean in the blojsom.xml.
<value>org.blojsom.plugin.registration.messages </value>
Add the following bean definition to your blojsom-plugins.xml.
<bean id="registration" class=" org.blojsom.plugin.registration.RegistrationPlugin" init-method="init" destroy-method="destroy">
        <property name="authorizationProvider">
            <ref bean="authorizationProvider"/>
        </property>
        <property name="resourceManager">
            <ref bean="resourceManager"/>
        </property>
        <property name="fetcher">
            <ref bean="fetcher"/>
        </property>
</bean>
Somewhere on your site (ideally your login page when using FormAuthenticationPlugin) add a link to the registration plugin. For example
<a href="#BlogAdminURL()/?plugins=registration&action=page">#adminResource('registration.link.text' 'Register for an account (quick, free, easy)')
The key here is the presence of "?plugins=registration" in the URL, telling Blojsom to load the RegistrationPlugin and display its default page.

Create two template files for your desired flavor: one for the registration page itself and one for the email that is sent with the user's username, password and an activation link. Users will be given a status of "registered" when they are created by this plugin. If the user click the activation link their status will be changed to "approved." Note that at present it is not necessary for a user to activate their account (no check is performed to ensure they have activated their account). Since they can only get their password via email at least you know you've got a user with a valid email address.

The registration page needs to have at least a username and email field and ideally will contain fullname as well. Custom properties can also be collected in the registration form and can be required or optional or some of both. To specify required fields, set a custom property on your blog with the key " registration-user-required-metadata-keys" and the value containing a comma-separated list of property keys. To specify optional fields, set a custom property on your blog with the key " registration-user-optional-metadata-keys" and the value containing a comma-separated list of property keys. In both cases the property keys should all end in _property.

Then to collect the information for these keys, add fields to your registration form using the names you specified in either or both of the aforementioned blog properties ( registration-user-required-metadata-keys and registration-user-optional-metadata-keys). If a user does not provide a required property a the user will be notified that a value must be supplied for that field (as long as your template contains #showErrorMessage() Velocimacro).
To accompany the registration plugin is the ViewBlogUserPropertiesPlugin. This is added to the admin console in the User management section. It provides a page that lists the properties for each blog user, including the standard fullname, email, status, and registration date. This is a a view only plugin (though it might be nice to have another plugin that would allow the users themselves to edit their own properties -- perhaps another time). To use this plugin simply add the following bean definition to the blojsom-plugins.xml file. Everything else necessary is contained in the patch.
<bean id="view-user-properties" class="org.blojsom.plugin.admin.ViewBlogUserPropertiesPlugin " init-method="init" destroy-method="destroy">
        <property name="authorizationProvider">
            <ref bean="authorizationProvider"/>
        </property>
        <property name="resourceManager">
            <ref bean="resourceManager"/>
        </property>
        <property name="fetcher">
            <ref bean="fetcher"/>
        </property>
</bean>

These plugins are contained in the attached patches. I hope they'll be useful for others.

Eric


 All   Comments   Change History      Sort Order:
There are no comments yet on this issue.