Appearance
Advisable Services Newsfeed
Flow ID: AD-57 | Module(s): core (admin), settings | Complexity: Low Last Updated: 2026-04-04
Business Context
The Advisable Services newsfeed is a notification/news widget displayed in the admin panel header. It integrates with the external Advisable Services API to show platform news, service updates, support status, billing information, and other account-level data to admin users. The newsfeed is part of a broader "Advisable Services" integration that also surfaces lease status, unpaid services, deadlines, OTP, and support hour consumption.
The feature is controlled by the OTHER/ENABLE_NEWSFEED registry key and requires the OTHER/SERVICES_ENABLED and OTHER/SERVICES_API_KEY registry keys to be configured. It is only visible to users with Advisable or Admin roles.
API Reference
REST Endpoints
No REST API. The newsfeed data is fetched server-side during admin page load and injected as JSON state.
External API
The Adv_advisable_services library communicates with an external Advisable Services API:
| Endpoint (via library) | Description |
|---|---|
customerLeaseStatus | Whether the client is on a lease plan |
customerUnpaidServices | Count of unpaid services |
customerDeadline | Account deadline date |
customerRecurringServices | Recurring service subscriptions |
customerOTP | One-time password or token |
customerSupportStatus | Whether support hours are active |
customerConsumedHours | Support hours consumed and last paid date |
| News feed data | Platform news items (when enabled) |
Code Flow
Admin Page Load (Every Admin Page)
Adv_admin_controller::__construct()
|
+--> render['enable_news'] = registry->value('OTHER', 'ENABLE_NEWSFEED')
|
+--> setupAdvisableServicesJsonState()
|
+--> Check: user must be Advisable or Admin role
+--> Check: registry 'OTHER/SERVICES_ENABLED' must be truthy
| (If either check fails, return with disabled state)
|
+--> Load registry values:
| - enable_news = registry->value('OTHER', 'ENABLE_NEWSFEED')
| - serviceAuthKey = registry->value('OTHER', 'SERVICES_API_KEY')
|
+--> Load advisable_services library with:
| - serviceAuthKey
| - config->item('advisableServicesUrl')
| - config->item('advisableServicesTimeoutSeconds')
|
+--> pscache->library('advisable_services',
| 'buildAdvisableServicesJsonState', [$enable_news],
| config->item('advisableServicesCacheTTLSeconds'))
| (Cached API call -- avoids hitting external API on every page load)
|
+--> render['advisableServicesJsonState'] = JSON state object
+--> render['advisableServicesEnabledCssClass'] = 'services-enabled'Building the JSON State
Adv_advisable_services::buildAdvisableServicesJsonState($enableNews)
|
+--> Create AdvisableServicesJsonState value object
+--> Fetch customer aggregate data from external API
+--> Populate state:
| - areNewsEnabled, baseUrl, isLease, unpaidServices
| - deadline, recurringServices, OTP
| - areSupportHoursEnabled, supportHoursConsumed, lastPaidDate
|
+--> If news enabled: fetch and attach news feed items
+--> Return state object (serialized as JSON for frontend)Settings Toggle
Adv_settings::other() (settings controller)
|
+--> On POST: registry->setValue('OTHER', 'ENABLE_NEWSFEED', (int)post('other_enable_news'))
+--> On GET: load current value for form displayDomain Layer
Modern Classes (src/)
| File | Responsibility |
|---|---|
src/Services/State/ValueObject/AdvisableServicesJsonState.php | JSON state value object |
src/Services/State/ValueObject/AdvisableServicesHttpClientConfig.php | HTTP client configuration |
src/Services/Traits/AdvisableServicesHttpClientTrait.php | HTTP client trait for API calls |
Legacy Layer (ecommercen/)
| File | Responsibility |
|---|---|
ecommercen/libraries/Adv_advisable_services.php | Services library (API client) |
ecommercen/core/Adv_admin_controller.php | Base admin controller (lines 126, 287-325) |
ecommercen/settings/controllers/Adv_settings.php | Settings controller (enable/disable toggle) |
Data Model
No dedicated tables. Configuration stored in the registry table:
| Registry Group | Key | Description |
|---|---|---|
OTHER | ENABLE_NEWSFEED | Enable/disable the newsfeed widget (1/0) |
OTHER | SERVICES_ENABLED | Master switch for Advisable Services integration |
OTHER | SERVICES_API_KEY | Authentication key for the external API |
Seeded in database/seeders/InitialSeed.php with ENABLE_NEWSFEED = 1 as default.
Configuration
| Source | Key | Description |
|---|---|---|
| Config | advisableServicesUrl | Base URL of the external Advisable Services API |
| Config | advisableServicesTimeoutSeconds | HTTP timeout for API requests |
| Config | advisableServicesCacheTTLSeconds | Cache TTL for the aggregated services state |
| Registry | OTHER/ENABLE_NEWSFEED | Toggle newsfeed on/off |
| Registry | OTHER/SERVICES_ENABLED | Master toggle for all Advisable Services |
| Registry | OTHER/SERVICES_API_KEY | API authentication key |
Required roles: AUTH_ROLE_ADVISABLE or AUTH_ROLE_ADMIN (checked at runtime in setupAdvisableServicesJsonState()).
Client Extension Points
- Disable entirely: Set
OTHER/SERVICES_ENABLEDto 0 in the registry - Toggle newsfeed only: Set
OTHER/ENABLE_NEWSFEEDto 0 to hide the news widget while keeping other services data
Business Rules
- Double gate: The newsfeed requires both
SERVICES_ENABLEDand the user having Advisable/Admin role.ENABLE_NEWSFEEDfurther controls whether news items specifically are fetched. - Cached API calls: The external API response is cached using
pscachewith a configurable TTL to avoid repeated HTTP calls on every admin page load. - Graceful degradation: If the external API call fails (network error, timeout), the error is logged and the admin panel continues to function with the services widget in a disabled state.
- Per-page load: The services state is evaluated on every admin page load (in the base controller constructor), not just on a specific page.
- Frontend JSON: The state is serialized as JSON and injected into the admin view for client-side rendering of the services widget.
Related Flows
- AD-13 Settings -- Settings page where the newsfeed toggle is configured
- AD-01 Admin Auth -- Role-based access that gates the newsfeed