| 1 |
|
membership.module |
| 2 |
|
================= |
| 3 |
|
CSÉCSY László <boobaa@frugalware.org> |
| 4 |
|
2008-05-05 |
| 5 |
|
:revision: 5.x-1.1 |
| 6 |
|
|
| 7 |
|
== Introduction |
| 8 |
|
|
| 9 |
|
The membership module provides easy time-limited membership management. |
| 10 |
|
|
| 11 |
|
== Installation |
| 12 |
|
|
| 13 |
|
Simply untar the module to the usual place, set up the permissions at |
| 14 |
|
*admin/user/access*, and select the role to has time-limited membership at |
| 15 |
|
*admin/settings/membership*. You may want to select the Power Manager as well, |
| 16 |
|
who will be sent notifies from those who have the _administer membership_ |
| 17 |
|
permission. The module relies upon Drupal's cron hooks, so it may be wise to |
| 18 |
|
have the cron part (eg. *cron.php*) be run regularly. |
| 19 |
|
|
| 20 |
|
== Permissions |
| 21 |
|
|
| 22 |
|
The module introduces the following permissions. |
| 23 |
|
|
| 24 |
|
*access membership*:: Allows using the basic functions like adding a user to the |
| 25 |
|
pre-selected role in a time-limited manner. |
| 26 |
|
|
| 27 |
|
*administer membership*:: Allows setting up the module like specifying the |
| 28 |
|
time-limited role. |
| 29 |
|
|
| 30 |
|
== Tasks |
| 31 |
|
|
| 32 |
|
=== Administering the module |
| 33 |
|
|
| 34 |
|
With the _administer membership_ permission one is expected to set up the module |
| 35 |
|
before making use of it by the means of a form accessible at |
| 36 |
|
*admin/settings/membership*. A role must be selected to have time-limited |
| 37 |
|
membership management, with the following restrictions: |
| 38 |
|
|
| 39 |
|
* basic Drupal roles (ie. _anonymous user_ and _authenticated user_) cannot be |
| 40 |
|
selected; |
| 41 |
|
* the time-limited role cannot be changed if it already has any members. |
| 42 |
|
|
| 43 |
|
A Power Manager can also be selected from the users with _access membership_ |
| 44 |
|
role, who will be receiving notifications on all and any changes in the |
| 45 |
|
time-limited role's membership. |
| 46 |
|
|
| 47 |
|
=== List users with time-limited membership |
| 48 |
|
|
| 49 |
|
With the _access membership_ permission one is allowed to list the users with |
| 50 |
|
time-limited membership with the following columns: |
| 51 |
|
|
| 52 |
|
* username, |
| 53 |
|
* last modified, |
| 54 |
|
* expires, |
| 55 |
|
* operations. |
| 56 |
|
|
| 57 |
|
The latter consists of two links: *Expire now* and *Edit membership*. The list |
| 58 |
|
can be sorted by any of the first three columns. Under the list a form is shown |
| 59 |
|
to add a new user to the time-limited role. |
| 60 |
|
|
| 61 |
|
=== Add a user to the time-limited role |
| 62 |
|
|
| 63 |
|
There are two fields to be filled: the username (with autocomplete, to make your |
| 64 |
|
life easier) and the date of the expiration. Username is verified whether it |
| 65 |
|
exists and whether he/she is already member of the time-limited role. Expiration |
| 66 |
|
date must be in the future. If everything goes well, the specified user is added |
| 67 |
|
to the time-limited role (thus to the list mentioned at the previous task), a |
| 68 |
|
notification is sent to the user him/herself, and to the Power Manager, if |
| 69 |
|
selected. |
| 70 |
|
|
| 71 |
|
=== Remove a user from the time-limited role by hand (Expire now) |
| 72 |
|
|
| 73 |
|
Clicking on an *Expire now* link immediately removes the specified user from the |
| 74 |
|
time-limited role and the above-mentioned list (without any further |
| 75 |
|
confirmation), sends a notification to the user him/herself, and to the Power |
| 76 |
|
Manager, if selected. |
| 77 |
|
|
| 78 |
|
=== Edit a user's membership information |
| 79 |
|
|
| 80 |
|
Clicking on an *Edit membership* link leads to a form with only one date field, |
| 81 |
|
which allows changing the time-limited membership expiration date of the |
| 82 |
|
specified user. The date cannot be changed to be in the past. If everything goes |
| 83 |
|
well, the specified user's membership info is changed (the last modification |
| 84 |
|
time as well), a notification is sent to the user him/herself, and to the Power |
| 85 |
|
Manager, if selected. |
| 86 |
|
|
| 87 |
|
=== Automatic membership expiration |
| 88 |
|
|
| 89 |
|
The module's cron hook is responsible to remove users from the time-limited |
| 90 |
|
role when their membership expires. The affected users are sent a notification, |
| 91 |
|
as well as the Power Manager, if selected. |
| 92 |
|
|
| 93 |
|
== Database |
| 94 |
|
|
| 95 |
|
As the time of writing only MySQL is supported. |
| 96 |
|
|
| 97 |
|
=== *membership* table |
| 98 |
|
|
| 99 |
|
Contains time-limited membership information with the following fields: |
| 100 |
|
|
| 101 |
|
* *mid*: membership's unique ID; |
| 102 |
|
* *uid*: member's \{users\}.uid; |
| 103 |
|
* *uid*: owner's \{users\}.uid (the user who added this member); |
| 104 |
|
* *lastmod*: membership's last modification time as a UNIX timestamp; |
| 105 |
|
* *expires*: membership's expiration time as a UNIX timestamp. |
| 106 |
|
|
| 107 |
|
== Views support |
| 108 |
|
|
| 109 |
|
The module provides one field for views.module: "Membership: Expires", which |
| 110 |
|
simply displays expiration date of author's membership. The option field may be |
| 111 |
|
used to specify the custom date format as it's required by the date() function. |
| 112 |
|
|
| 113 |
|
== Ideas to be implemented |
| 114 |
|
|
| 115 |
|
* Add new user in a block - http://drupal.org/node/240359[] |
| 116 |
|
* Log membership changes to the watchdog - http://drupal.org/node/237027[] |
| 117 |
|
* Ability to change the notifications' text - http://drupal.org/node/237020[] |
| 118 |
|
* Ability to set a date when all members' membership expires - |
| 119 |
|
http://drupal.org/node/237018[] |
| 120 |
|
* Prevent changing the time-limited role's membership through other (core |
| 121 |
|
Drupal) forms. |
| 122 |
|
|
| 123 |
|
// vim: set tw=80: |