Architecture.

In hope that this installation profile may be of use to others, I write here a description of the architecture of this profile. My hope is always to make discreet, reusable components that other developers can modify or build on. The architecture is deliberately simple because my first interest is module development more than site design. Also LETS groups are not very ambitious with technology. A LETS is a grass roots community club which exists for its members to exchange things without money. Typically it provides an accounting system, a directory of offers and wants and a newsletter. Its a great social technology for building relationships and strengthening community but does not concern itself with the full spectrum of community activities or with monetary reform. Each one is managed by a usually conservative committee. Most groups have between 50 and 150 members.

This main installation profile aims to provide some basic services and the included modules are optional / replacable features which depend on certain elements of the profile. One theme is included, a heavily modified version of Sky (which doesn't use the standard regions, but should).

The cforge.profile defines many things common to all use cases (LETS). They are realworld membership groups with a management structure and a reluctance to do too much online, A full list follows, and then a brief description of the 'features'.

Settings
Two node-types are defined, page and story, as in the 'standard' profile.
Two new filters are defined for use with the ckeditor.
5 roles are defined - trader, committee, accountant, local admin, and system. The last one is for non-member accounts because the mutual credit module uses user IDs for accounting.
7 user profile fields.
Some presets are provided for the contact module for ease of setup
Some default pages are provided for ease of setup. Also a block with a video in the appropriate language.
the backup and migrate module allows only downloads and restorations of the whole database dump
Two permissions are provided corresponding to the roles, local admin and committee.
A list of neighbourhoods should be provided to enable localised search

Builtin features
Realnames hack - rather than relying on the realnames module, the firstname and secondname (required fields) comprise the username. In community there is no expectation of anonymity. The drupal autocomplete function is overridden to support this searching on username, email, or uid.
Password strength checker is disabled since users found it annoying.
Login_redirect is implemented in one line of code to take user to a view of recent articles.
Captcha is configured for account creation
Community Tasks module is included as is.
Addressfield module has been overridden to include a required 'neighbourhood' field, regardless of country
User profile fields are spread out accross 3 tabs, My info (default), Settings, and manage, which is only accessible to committee

Provided theme
The blue and white theme is pretty simple, owing to lack of skilled volunteers.
It works ok on mobile phones.
It contains no logic, so its easy to replace.
Clients have rarely complained.

Modules created for Hamlets:

Currencies module configures the Community Accounting tool.
it adds a description field, and the offers_wants_categories vocabulary to the transaction entity.
It defines a currency, hours, and two payment forms.
It adds the balance history chart, balances, balance limits and pending transactions to the user profile.
It moves the limits setting to the 'manage' tab on the user profile
Provides a theme callback for balance limts, using google speedometer
moves the masspay menu items to be tabs under path 'transact'
sets the message for pending notifications

Broadcast module allows permitted users to email a node to other users in their neighbourhood, or to all other users.
This is done not using the permission system but from a config field on the cforge settings page.
Users can opt out of these 'broadcast' mail notifications.
Each node can only be broadcast once, and the node sticky flag is repurposed to indicate whether the node has been broadcast.

Docs module creates a new content type, document, which takes attached files, and a new vocabulary for it.
Documents can only be viewed by authenticated users.
A page view shows documents, by category

Events module creates a content-type, event, and a page view and block view for it.

Gallery module creates a content-type, photo, and a vocabulary, galleries for categorising it.
A gallery page leads to individual galleries where each photo can be viewed full size.
A block shows random photos.

Import module supports new or migrated groups to import their data and mail all users their login details.
- It enables offers_wants_import, mcapi_import and uif (User import framework) (but doesn't disable them)
- Admin can compose an email, test it
- All users who have never logged in are sent a one-time-login link
- Includes uif hooks for addressfield module

The offline module supports users without or with limited internet access in 4 ways
-It allows them to nominate other users who can log in as them, using the masquerade_nominate module.
-it diverts mails to those users to the nominands
-It provides printable views of offers, wants, and members.
-It provides a grid view of addresses, which might be suitable for printing.

Users should check the box in user/%/account/edit to qualify as 'offline'

Conceals the address field, phone number and name according to one of three settings.
Admin chooses default access and whether users choose their own

Yellow pages module configures the offers_wants module.
Provides a choice of preset terms for the categories vocabulary
Adds a menu item to the user-menu

Solsearch is a global web service which indexes offers and wants and makes them searchable. You can join the solsearch service by emailing info@clearingcentral.net to get an API key, enabling the solsearch module, and entering the API key into the config form.


Frontend(s)
The last stage of installation offers an opportunity to choose between 'frontends'.
Only one, default frontend is currently provided.
The 'frontend' file allows you to preconfigure menus and blocks and the theme, as well as adding other arbitrary setup code.
This enables you to build similar distributions, running all the same code, but with a different user experience.



=== THANKS ===
This installation profile and some the modules that comprise it are the fruits of 3 1/2 years concentrated effort. Community Forge would like to acknowledge the participation of many individual who have contributed materially or otherwise.
First of all the users, for tolerating and reporting issues. Users are the best testers, and the only testers in absence of other resources. Most of users comprise a several SELs in French speaking Europe, especially SEL du Lac in Geneva and the SELs in Wallonia, Belgium.
In Belgium, Bernard Simon, who brought many early adopter SELs
Marie Ullens for testing and protecting me from the Belgians
Art Brock and Timebanks USA, early adoptors of the Community Accounting module
Route des SEL which brought 3000 user to the Community Accounting early on
Objectif Gaia retreat centre outside Geneva.
Mary Fee, for gathering and understanding requirements over many years
Danièle Warynski, behind the scenes in Geneva
Olivier Hetzl, Auroville, for moral and financial support
Annette Loudon for her consistent advocacy
Stephanie Rearick, for bringing the first time bank to Hamlets


== SCRIPTS ===
//user pictures did not become managed files during upgrade
foreach ($filenames as $pic) {
  $uid = substr(substr($pic, 8), 0, -4);
  $uri = 'public://pictures/'.$pic;
  if ($fid = db_query("SELECT fid FROM {file_managed} WHERE uri = :uri", array(':uri' => $uri))->fetchfield()) {debug($fid, 'already');continue; }
  $fields = array(
    'uid' => $uid,
    'uri' => $uri,
    'filename' => $pic,
    'filemime' => 'image/jpeg',
    'status' => 1,
    'timestamp' => REQUEST_TIME
  );
  $fid = db_insert('file_managed')->fields($fields)->execute();
  db_update('users')->fields(array('picture' => $fid))->condition('uid', $uid)->execute();
}


//The following SQL can be used to pull the migratable data out of a drupal 6 database into csv format ready to import into Drupal 7
SELECT u.uid, u.name, mail, created, v1.value AS firstname, v2.value AS lastname, v3.value, v4.value AS phone1, v5.value AS phone2, v6.value AS postal_code, v7.value, v8.value AS address, v9.value
FROM `users` u
LEFT JOIN profile_values v1 ON v1.uid = u.uid AND v1.fid =1
LEFT JOIN profile_values v2 ON v2.uid = u.uid AND v2.fid =2
LEFT JOIN profile_values v3 ON v3.uid = u.uid AND v3.fid =3
LEFT JOIN profile_values v4 ON v4.uid = u.uid AND v4.fid =4
LEFT JOIN profile_values v5 ON v5.uid = u.uid AND v5.fid =5
LEFT JOIN profile_values v6 ON v6.uid = u.uid AND v6.fid =6
LEFT JOIN profile_values v7 ON v7.uid = u.uid AND v7.fid =7
LEFT JOIN profile_values v8 ON v8.uid = u.uid AND v8.fid =8
LEFT JOIN profile_values v9 ON v9.uid = u.uid AND v9.fid =9
WHERE u.uid >1

SELECT n.uid, n.title
FROM node n LEFT JOIN offers_wants ow ON n.nid = ow.nid
WHERE n.status = 1 AND n.type = 'proposition' AND ow.want = 0

SELECT n.nid as xid, n.title as description, e.payer_uid as payer, e.payee_uid as payee, e.quantity, '1stparty' as type
FROM node n LEFT JOIN mc_exchanges e ON n.nid = e.nid
WHERE e.state <> -1
