Gallery3:Modules:register - Gallery Codex
Personal tools

Gallery3:Modules:register

From Gallery Codex

Registration Module

User Registration
Not compatible with Beta3 use a recent git version.

Description

This module for Gallery 3 can be used to allow administrators to create and implement a policy to allow visitors to register as users. Its strongly encouraged that if you are using this module, you should enable the recaptcha module as well.

Available Policies:

  • Only site administrators can create new user accounts.
The register module is installed, but effectively disabled. All user creation follows the normal gallery3 defaults as defined by current identity provider.
  • Visitors can create an account without confirmation nor admin approval
If this approach is implemented, After an anonymous user fills in the registration form, their user account is created, they are automatically logged in, and a welcome dialog displays that allows them to set their password from the randomly generated default.
  • Visitors can create an account with confirmation email and no admin approval
Under this approach, after a user fills out the registration form, an email is sent to the address they specified. It contains a link that they can use to confirm their desire for an account. Once they confirm their account, the account is enabled, they are logged into Gallery3 and a welcome dialog displays that allows them to set their password from the randomly generated default
  • Visitors can create an account with confirmation and admin approval
In this approach, after a user fills out the registration form, an email is sent to the address they specified. It contains a link that they can use to confirm their desire for an account. Once they confirm their account a message is displayed indicating there request is waiting for administrator approval. Once the administrator approves their request, another email is sent indicating that their account has been created. It contains a link that allows a first time login which will request them to change their password from the randomly generated default
  • The users can be attached to a default group.
In order to enable this feature, at least one group besides Everybody and Registered Users must have been created.

New for version 2:

  • Option to send new pending user registration notifications to admin
When new pending users need approval, this gives the option to fire off an email to the Gallery 'reply to' address to notify the admin.
  • Improved multi-lingual (i18n) functionality
All emails sent to the pending user are in their language; all emails (and site notifications) sent to the admin are in the Gallery default language. Also, the encoding of emails has been corrected to UTF-8.
  • Added option for subject prefix on emails (e.g. '[Gallery3] ')
This can help identify emails as pertaining to the site.
  • Added CSS to define dialog box size
This is useful for compatibility with newer themes (e.g. GreyDragon 4)


Installation / Configuration

This module may be downloaded from the Gallery-contrib git repository here

Click the download button for the module you want. Extract the registration module to your gallery3/modules directory.

Activate the module: Login -> Admin -> Modules. Check the box next to the module.

Click update at the bottom of the page.

Operation / usage

Once installed you can enable the user registration policy. Click Admin -> Settings -> User registration.

Notes

You can not have a album named 'register'.

Tweaks/Fixes for multi-lingual localization (OUTDATED - all issues resolved in v2)

NOTE: this section is outdated, as all issues have been resolved in v2.

Use of translation mode

Gallery 3 has a great translation mode built-in, but there's a slight trick needed to tweak the register text. Once the translation mode is enabled, you need to click Show All. This is already documented (see localization docs [1]), but I thought I'd repeat it here anyway. Then, search for the text to change (including the text of the emails it sends) and translate them.

Email encoding

As-is, the register module does not deal with diacritics (accent marks) very well. This is because although most references to ISO-8859-1 were changed to UTF-8 in the core code (see the closed fix ticket [2]), this was not propagated through to the register module.

In \modules\register\helpers\register.php, search for "8859" and find the line of code near the end. Change:

     ->header("Content-type", "text/html; charset=iso-8859-1")

to:

     ->header("Content-type", "text/html; charset=utf-8")

Default language of guest user

It's important to set the default language of the "guest" user to "none." This will ensure that a new user, who has never been to the site and doesn't yet have any cookies, will get the site in their computer's default language.

Language of confirmation email

The above step will ensure that the login/register screens and the first two emails sent will be in the language of the user's computer. However, this does *not* guarantee the language of the final confirmation email. The language of the final confirmation email is determined by the language of the admin when they approve the new user's request.

The solution is fairly simple: change your current language on your admin account to the language you want the email to be in before you click "approve." As a tip, note that the notification at the top of the admin screen will be given in the language of the new user... all you have to do is copy it.

Changelog

  • 2012/09/30, version 2 by shadlaws
added option to send new pending user registration notifications to admin
improved multi-lingual (i18n) functionality
added option for subject prefix on emails (e.g. '[Gallery3] ')
added CSS to define dialog box size (compatibility with newer themes)
  • version 1 by talmdal
initial release