# CC Soccer D11 - Session Handoff
**Date:** March 11, 2026
**Session:** Add Credits tab to player user profile, local environment sync
**Branch:** `main`

## Last Updated
2026-03-11

## Current State
- All core functionality working
- Credits tab now appears on player user profiles alongside View, Payment methods, Edit, Orders
- Both /my-credits dropdown link and /user/{uid}/credits profile tab show same content
- Admin Credits (Admin) tab only visible to users with view reports permission

---

## What Was Done This Session

### 1. Credits Tab on User Profile

Added a Credits tab to the user profile pages so players can view their credit balance and history directly from their profile, consistent with the other profile tabs (View, Payment methods, Edit, Orders).

**New route:** `ccsoccer.user_credits` at `/user/{user}/credits`
- Custom access check: players can only view their own credits
- Admins with view reports permission can view any user credits

**Controller changes:** Refactored `PlayerCreditsController` to share logic
- Extracted `buildCreditsPage($uid)` from the existing `page()` method
- Added `userPage(UserInterface $user)` for the profile tab route
- Added `access(UserInterface $user, AccountInterface $account)` for own-user access control
- Original `/my-credits` route and My Account dropdown link unchanged

**Local task:** Added `ccsoccer.user_credits` to `ccsoccer.links.task.yml`
- Weight 45 (after Orders, before admin Credits tab at weight 50)
- Renamed existing admin tab to Credits (Admin) to distinguish

### 2. Local Environment Sync Notes

Discussed how to sync local DDEV environment after Caleb's commit (1e2a674):
- `git pull` + `ddev composer install` + `ddev drush updb -y` + `ddev drush cim -y` + `ddev drush cr`
- No need for `--ignore-platform-req=ext-intl` when running through DDEV (ext-intl is included in the container)
- The other developer needed that flag because they run composer on the host machine

### 3. Config Import Loop (Known Issue)

`views.view.commerce_order_item_table_admin` shows as needing update on every `drush cim` run. This is a known Commerce module behavior where it recalculates view field definitions during cache rebuild, causing the active config to differ from the exported YAML. Harmless. Fix: run `drush cim -y && drush cex -y`, commit the updated YAML.

### 4. Missing Contextual Theme Error (Pre-existing)

Error on user profile pages: "The following theme is missing from the file system: contextual". This is a stale database reference, not related to this session's changes. Fix: `ddev drush ev "\Drupal::keyValue('system.schema')->delete('contextual');" && ddev drush cr`

---

## Files Modified This Session

| File | Changes |
|------|---------|
| `web/modules/custom/ccsoccer/ccsoccer.routing.yml` | Added `ccsoccer.user_credits` route at `/user/{user}/credits` with custom access check |
| `web/modules/custom/ccsoccer/src/Controller/PlayerCreditsController.php` | Refactored `page()` to use shared `buildCreditsPage($uid)`; added `userPage()` and `access()` methods; added use statements for AccessResult, AccountInterface, UserInterface |
| `web/modules/custom/ccsoccer/ccsoccer.links.task.yml` | Added `ccsoccer.user_credits` local task (weight 45); renamed admin tab to Credits (Admin) |

---

## Remaining Work

### Content
- [ ] Add description to 2026 Summer Cup tournament entity (`/admin/ccsoccer/tournaments`)

### Inner Page Styling
- [ ] Credits page
- [ ] Purchase Jerseys page
- [ ] Group management page

### Forms
- [ ] Registration form inputs, buttons, visual styling

### Navigation / Mobile
- [ ] 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
- [ ] Enable reCAPTCHA on registration form; configure site key/secret in production `settings.local.php`
- [ ] Self-host Inter font
- [ ] Enable CSS/JS aggregation on test + production before launch
- [ ] Final mobile/browser testing
- [ ] Remove IP whitelist block from production `.htaccess`
- [ ] Decide canonical domain (www vs non-www)
- [ ] Confirm HTTPS redirect handling

### 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
- [ ] Fix contextual theme stale database reference
- [ ] Fix Commerce config import loop (cex after cim, commit updated YAML)

---

## Test Server .htaccess (IP Whitelist)

The test server `.htaccess` has an IP whitelist block that is **not in git**.
It's protected from being overwritten by pulls via `skip-worktree`.

If the whitelist is ever lost again, paste this near the top of `web/.htaccess`
(before the `<FilesMatch>` block), then re-run the skip-worktree command:

```apache
# IP Whitelist - Test server only (DO NOT commit to git)
# Note: inline comments after IPs cause 500 errors - keep IPs on one line, no comments
# Note: <RequireAny> container causes 500 on InMotion shared hosting - use single line
# Caleb/Layne: 68.249.41.9 | Andrew: 35.151.50.130 | Dave: 99.8.107.54 | Haley: 97.84.70.141
Require ip 68.249.41.9 35.151.50.130 99.8.107.54 97.84.70.141

# Prevent search engine indexing - Test server only
<IfModule mod_headers.c>
  Header set X-Robots-Tag "noindex, nofollow, noarchive"
</IfModule>
```

```bash
# Run once after editing - prevents git pull from overwriting
git update-index --skip-worktree web/.htaccess
```

---

## Server Quick Reference
```bash
cd ~/public_html/test_ccsoccer_site
git pull

# If composer.lock changed (core updates, module adds/removes):
PATH=/opt/cpanel/ea-php83/root/usr/bin:$PATH /opt/cpanel/ea-php83/root/usr/bin/php /opt/cpanel/composer/bin/composer install --ignore-platform-req=ext-intl

# Standard post-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 -y
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
```

## 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
