# CC Soccer D11 - Session Handoff
**Date:** March 2, 2026
**Session:** Site instance identification, notification gating, color update, hub fixes
**Branch:** `main`

## Last Updated
2026-03-02

## Current State
- All core functionality working
- Site instance identification system live (`site_instance` in settings.local.php)
- Notification gating fully implemented — non-production sends only to board contacts
- Brand color updated to #B80000
- My Account hub fixed and expanded
- Schema version: 9055 (no changes this session)

---

## ⚠️ Andrew: IMPORTANT — Read Before Pulling

`settings.local.php` was previously tracked in git and has now been removed from tracking. **Before you run `git pull`:**

```bash
# 1. Back up your settings.local.php first
cp web/sites/default/settings.local.php ~/settings.local.php.bak

# 2. Pull
git pull

# 3. If your file was deleted, restore it
cp ~/settings.local.php.bak web/sites/default/settings.local.php

# 4. Remove it from git tracking on your machine (one-time)
git rm --cached web/sites/default/settings.local.php

# 5. Clear cache
PATH=/opt/cpanel/ea-php83/root/usr/bin:$PATH /opt/cpanel/ea-php83/root/usr/bin/php vendor/drush/drush/drush.php -r web cr
```

After step 4, `.gitignore` will permanently keep `settings.local.php` out of git on your machine.

### Add to your settings.local.php
You need to add this line to identify the test server instance:
```php
// Site instance - controls notification gating and dev banner label
// Values: 'local' (DDEV), 'test' (test.ccsoccer.com), 'production' (or absent)
$settings['site_instance'] = 'test';
```

No schema changes this session — no `updb` needed.

---

## What Was Done This Session

### Site Instance Identification
- Replaced `$settings['dev_mode']` boolean with `$settings['site_instance']` string
- Values: `'local'` (DDEV), `'test'` (test.ccsoccer.com), `'production'` (or absent)
- Local `settings.local.php` updated to `site_instance = 'local'`
- Dev banner in `ccsoccer_preprocess_block()` updated to read new setting

### Dev Banner — Moved to Tagline Position
- Old approach modified `system_branding_block` — didn't work with custom theme
- New approach: `hook_preprocess_page()` injects `site_tagline` variable
- Template updated: `<span class="site-tagline">{{ site_tagline|raw }}</span>`
- On production: shows normal tagline text
- On local: orange badge "LOCAL" + username/role/UID
- On test: blue badge "TEST" + username/role/UID

### Notification Gating (NotificationService.php)
- **New methods:** `getSiteInstance()`, `isProduction()`, `getAllowedContacts()`
- `getAllowedContacts()` — builds allowlist from board member contacts (board email/phone + personal fallback), statically cached per request to avoid repeated DB queries
- `sendEmail()` — on non-production, blocks delivery unless recipient is in board allowlist; tags subject with `[LOCAL]` or `[TEST]`
- `sendSms()` — same allowlist gating, replaces old `IS_DDEV_PROJECT` env var approach
- `sendBulk()` — completely blocked on non-production; board still gets `[VERIFY]` copy via normal `sendToBoard()` which passes through the allowlist
- `isDevEnvironment()` kept as deprecated wrapper for backward compatibility

### Brand Color Update (ccsoccer-tokens.css)
- `--color-primary`: `#8B0000` → `#B80000`
- `--color-primary-dark`: `#6B0000` → `#8B0000`
- `--color-primary-light`: `#a50000` → `#cc0000`
- `--shadow-primary`: updated rgba to match new primary

### My Account Hub (ContentController.php)
- Fixed `/my-team` → `/my-teams` (was 404ing)
- Added "My Profile" card linking to `/user/{uid}/edit`

### settings.local.php — Removed from Git Tracking
- `git rm --cached web/sites/default/settings.local.php` run on Caleb's machine
- File deleted from repo history going forward
- `.gitignore` entry was already present — will permanently exclude it now

---

## Files Modified This Session
- `web/sites/default/settings.local.php` — `dev_mode` → `site_instance = 'local'` (local only, not in repo)
- `web/modules/custom/ccsoccer/ccsoccer.module` — `ccsoccer_preprocess_block()` updated; new `ccsoccer_preprocess_page()` added
- `web/modules/custom/ccsoccer/css/ccsoccer-tokens.css` — brand color update
- `web/modules/custom/ccsoccer/src/Controller/ContentController.php` — hub link fix + profile card
- `web/modules/custom/ccsoccer/src/Service/NotificationService.php` — full notification gating system
- `web/themes/custom/ccsoccer_theme/templates/page.html.twig` — tagline now uses `{{ site_tagline|raw }}`

---

## Remaining Work

### Inner Page Styling
- [ ] My Orders page
- [ ] My Registrations page
- [ ] Credits page
- [ ] Purchase Jerseys page
- [ ] User profile / edit form
- [ ] Group management page

### Forms
- [ ] Registration form inputs, buttons, validation
- [ ] User register / edit forms

### Navigation / Mobile
- [ ] Mobile admin menu overlaps main nav — needs fix
- [ ] Re-add Tournament Schedule to main nav

### Notifications
- [ ] "Don't send to already registered" logic
- [ ] Automated reminders (6/4/2/1 week intervals)

### Deployment Prep
- [ ] Self-host Inter font
- [ ] Re-enable CSS/JS aggregation
- [ ] Final mobile/browser testing

### Small Items
- [ ] Breadcrumbs: custom builder for full trails on custom routes
- [ ] Game status: only show ON/CANCELLED after 3pm
- [ ] Contact page — does /contact exist? Footer links to it
- [ ] Social links — Facebook/Instagram URLs are placeholder (#)
- [ ] Hero width mismatch (doesn't go full bleed)
- [ ] Password reset flow for migrated users
- [ ] New user creation issues (Andrew may be handling)

---

## Server Quick Reference
```bash
cd ~/public_html/test_ccsoccer_site
git pull
PATH=/opt/cpanel/ea-php83/root/usr/bin:$PATH /opt/cpanel/ea-php83/root/usr/bin/php vendor/drush/drush/drush.php -r web updb
PATH=/opt/cpanel/ea-php83/root/usr/bin:$PATH /opt/cpanel/ea-php83/root/usr/bin/php vendor/drush/drush/drush.php -r web cr
```

**Note:** The `PATH=` prefix is required — drush spawns a subprocess via `vendor/bin/drush` which picks up system PHP 7.4 otherwise.

## Git Workflow
- Always `git pull` before `git push` — Andrew may have pushed changes
- `main` is the primary branch
- `settings.local.php` is NOT in git — never commit it, manage per-environment manually
