Findings — Research Summary

Events Page Research Findings

Date: 2026-03-16

Summary

The AlMaghrib mega menu is a React app (wp-plugin-megamenu on GitHub) that fetches all event data client-side from a single public API endpoint on the Laravel backend (api2.almaghrib on Bitbucket).


The API Endpoint

GET https://api2.almaghrib.org/v1/wp/mega-menu-events (public, no auth required)

Response Structure

{
  "onsite": {
    "weekend_seminars": { "upcoming": [...] },
    "ilmfests": { "upcoming": [...] },
    "ilmnights": { "upcoming": [...] },
    "community_events": { "upcoming": [...] }
  },
  "online": {
    "fall_semester": { "upcoming": [...] },
    "on_demand": { "upcoming": [...] },
    "mentorship": { "upcoming": [...] },
    "faith_essesntials": { "upcoming": [...], "plan": {...} }
  },
  "kids": {
    "ilmspring": { "upcoming": [...], "previous": [...] }
  },
  "travel": {
    "blessed_voyage": { "upcoming": [...], "planned": [...] }
  }
}

Per-Event Fields

Additional Endpoints


Backend (Laravel — api2.almaghrib on Bitbucket)

Controller: WpPluginController.phpgetMegaMenuEvents()

Data Flow

  1. GeoIP detects user's lat/lon from IP (via Request-IP-Address header)
  2. getNearbyQabail() ranks cities by distance (Haversine formula)
  3. Products grouped by ID → event types:
    • weekend_seminars = [1, 2, 8]
    • ilmfest = [3], ilmnight = [5], community_event = [21]
    • virtual = [11, 13], online/on-demand = [10]
    • mentorship = [15, 17], ilmspring/kids = [18]
  4. Model chain: Product → Course → Event with eager loading
  5. Events sorted by distance first, then start date

Key Models


Frontend (React — wp-plugin-megamenu on GitHub)

Repo: almaghrib-engineering/wp-plugin-megamenu

Architecture

Key Files


Current Live Data (as of 2026-03-16)

Category Count
Weekend Seminars 8
Ilm Nights 13
IlmFests 0
Community Events 0
Online On-Demand 1
Faith Essentials 40
Total Onsite 21

Continents with Events


Key Finding: We CAN Reuse the API

The mega-menu-events endpoint is public and returns all the data needed for a standalone events page:

Images are fully available — two sizes per event (poster 250x375 and background 960x600) plus instructor avatars, all on public CDN URLs. Note: some instructor avatars use a default placeholder.

No new backend work needed — the existing API provides everything.