Skip to content

commonknowledge/common-knowledge-join-flow-gmtu

Repository files navigation

CK Join Flow Extensions for GMTU

This add-on to the main CK Join Flow plugin includes functionality specific to the Greater Manchester Tenants Union (GMTU) installation.

Features

  • Postcode validation — Validates that postcodes are within the Greater Manchester coverage area and blocks out-of-area submissions with helpful error messages.
  • Branch assignment — Automatically assigns members to a branch (e.g. South Manchester, Harpurhey, Stockport) based on their postcode outcode.
  • Branch tagging — Adds the assigned branch name as a tag when members are synced to external services (Mailchimp, Zetkin, etc.).
  • Email notifications — Sends admin and branch-specific notification emails when a new member registers.
  • Postcode lookup caching — Caches postcodes.io API responses as WordPress transients (7-day TTL) to reduce external API calls.

Structure

join-gmtu.php              # Plugin entry point, config, hook registration
src/
  Logger.php               # Logging utilities (wraps joinBlockLog)
  Postcode.php             # Postcode outcode lookup via postcodes.io with caching
  Branch.php               # Branch map (outcode -> branch) and branch email map
  Member.php               # Extracts and formats member details from registration data
  Email.php                # Email body building and send functions
  PostcodeValidation.php   # Validates postcodes are within GM coverage area
  BranchAssignment.php     # Assigns branch to member data based on postcode
  Tagging.php              # Adds branch as tag in external services
  Notifications.php        # Registers success notification hooks

Configuration

The main configuration is in join-gmtu.php and includes:

  • Out-of-area error messages (for postcode lookup and form submission)
  • Admin notification email addresses
  • Notification subject and message templates

Branch-to-postcode mappings and branch email addresses are in src/Branch.php.

Local Development

Requires Docker. Spins up WordPress with the parent plugin installed, this plugin mounted and activated, and Mailpit to capture outbound emails.

docker compose up -d          # start stack
docker compose logs -f wpcli  # watch setup progress
Service URL Credentials
WordPress http://localhost:8080/wp-admin admin / admin
Mailpit http://localhost:8025

All emails sent by wp_mail() are captured in the Mailpit web UI.

docker compose down            # stop (keep data)
docker compose down -v         # stop and wipe all data

Tests

composer install
composer test

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •