Menu and Sidebar Context

WHMCS’s menus and sidebars render information that is specific to the page that the user accessed. For example, client information passes to Account () > My Account while ticket information passes to the list of support tickets. This data is passes to menu item objects as context. Context can be any PHP object or data type.

For more information about customizing Client Area navigation menus, see Client Area Navigation Menus and Client Area Sidebars.

The Menu Class

The Menu class has two static methods for setting and retrieving context items:

  • void Menu::addContext(string $key, mixed $value) — Add $value to the menu context at the key $key, overriding existing values.
  • mixed|null Menu::context(string $key) — Retrieve the menu context at $key, or null if no context exists at the key.

Preset Sidebars for Client Area Pages

The following sidebars ship with WHMCS:

SidebarPagesContext
affiliateViewaffiliates.php
announcementListannouncements.php
  • \WHMCS\User\Client|null: client — The currently-authenticated client, or null if the visitor is not authenticated.
  • Collection of the Carbon monthsWithAnnouncements value — The past ten months in which announcements have been published.
clientAddFundsclientarea.php?action=addfunds
  • \WHMCS\User\Client|null: client — The currently-authenticated client, or null if the visitor is not authenticated.
clientRegistrationregister.php
  • \WHMCS\User\Client|null: client — The currently-authenticated client, or null if the visitor is not authenticated.
  • Collection of the SecurityQuestion securityQuestions value — The configured security questions.
clientQuoteListclientarea.php?action=quotes
  • \WHMCS\User\Client|null: client — The currently-authenticated client, or null if the visitor is not authenticated.
clientView
  • clientarea.php
  • clientarea.php?action=addcontact
  • clientarea.php?action=changepw
  • clientarea.php?action=contacts
  • clientarea.php?action=details
  • clientarea.php?action=emails
  • clientarea.php?action=security
  • index.php?rp=/account/paymentmethods
  • \WHMCS\User\Client|null: client — The currently-authenticated client, or null if the visitor is not authenticated.
domainListclientarea.php?action=domains
  • \WHMCS\User\Client|null: client — The currently-authenticated client, or null if the visitor is not authenticated.
If the q request variable is defined, the system filters the client’s associated domain counts in the primary sidebar to the domains names that contain the q value.
domainView
  • clientarea.php?action=domaincontacts
  • clientarea.php?action=domaindetails
  • clientarea.php?action=domaindns
  • clientarea.php?action=domainemailforwarding
  • clientarea.php?action=domaingetepp
  • clientarea.php?action=domainregistrations
downloadList
  • dl.php
  • downloads.php
  • \WHMCS\User\Client|null: client — The client currently logged in, or null if no client is logged in. For more information, see the Client Internal Class Documentation.
  • Collection of the Download topFiveDownloads value — The five most-downloaded files that are not hidden or in a hidden category, in descending order of number of downloads.
  • \WHMCS\Download\Category — The current download category. For more information, see the Category Internal Class Documentation.
The system only passes the topFiveDownloads and downloadCategory contexts to download.php.
invoicelist
  • clientarea.php?action=invoices
  • clientarea.php?action=masspay
  • \WHMCS\User\Client|null: client — The currently-authenticated client, or null if the visitor is not authenticated.
networkIssueListserverstatus.php
  • \WHMCS\User\Client|null: client — The currently-authenticated client, or null if the visitor is not authenticated.
  • array: networkIssueStatusCounts — A key-value pair of network issue statuses and the number of network issues with each status.
orderFormViewcart.php
This page only supports the secondary sidebar.
  • \WHMCS\User\Client|null: client — The currently-authenticated client, or null if the visitor is not authenticated.
  • Collection of the Group productGroups value — The WHMCS installation’s configured product groups.
  • int: productGroupId — The current gid GET parameter’s value.
  • bool: domainRegistrationEnabled — Whether domain registration is enabled in WHMCS.
  • bool: domainTransferEnabled — Whether domain transfers are enabled in WHMCS.
  • bool: domainRenewalEnabled — Whether domain renewals are enabled in WHMCS.
  • string: domain — When configuring domain options, the name of the domain in the shopping cart.
  • string: currency — The user’s configured currency, or the system currency if the viewer is not authenticated. (For example, USD or GBP.)
serviceList
  • clientarea.php?action=hosting
  • clientarea.php?action=products
  • clientarea.php?action=services
  • \WHMCS\User\Client|null: client — The currently-authenticated client, or null if the visitor is not authenticated.
If the q request variable is defined, the system filters the client’s associated service counts in the primary sidebar to the domains names that contain the q value.
serviceUpgradeupgrade.php
  • \WHMCS\User\Client|null: client — The currently-authenticated client, or null if the visitor is not authenticated.
  • \WHMCS\Service\Service: service — The service that the client is upgrading. For more information, see the Service Internal Class Documentation.
serviceView
  • clientarea.php?action=cancel
  • clientarea.php?action=productdetails
  • \WHMCS\User\Client|null: client — The currently-authenticated client, or null if the visitor is not authenticated.
  • \WHMCS\Service\Service: service — The service that the client is viewing. For more information, see the Service Internal Class Documentation.
sslCertificateOrderViewconfiguressl.php
  • \WHMCS\User\Client|null: client — The currently-authenticated client, or null if the visitor is not authenticated.
  • \WHMCS\Service\Service: service — The service object that represents the SSL certificate that the client is ordering. For more information, see the Service Internal Class Documentation.
  • strong: orderStatus — The current status of the SSL certificate order.
  • array: displayData — A key-value pair of additional SSL certificate data that displays on the page on step two of the order process.
  • int: step — The current step in the order process.
supportVarious
The secondary support sidebar appears when a contact does not have permission to perform an action in the Client Area.
  • \WHMCS\User\Client|null: client — The currently-authenticated client, or null if the visitor is not authenticated.
supportKnowledgeBaseknowledgebase.php
  • \WHMCS\User\Client|null: client — The currently-authenticated client, or null if the visitor is not authenticated.
  • array: knowledgeBaseTags — An array of knowledge base tags and the number of articles with each tag.
ticketFeedbackviewticket.php
The system only uses this when a user enters feedback for a recently-closed ticket.
  • \WHMCS\User\Client|null: client — The currently-authenticated client, or null if the visitor is not authenticated.
ticketListsupporttickets.php
  • \WHMCS\User\Client|null: client — The currently-authenticated client, or null if the visitor is not authenticated.
  • array: ticketStatusCounts — A key-value pair of ticket statuses with the number of tickets in that status.
ticketSubmitsubmitticket.php
  • \WHMCS\User\Client|null: client — The currently-authenticated client, or null if the visitor is not authenticated.
ticketViewviewticket.php
  • \WHMCS\User\Client|null: client — The currently-authenticated client, or null if the visitor is not authenticated.
  • int: ticketid — The ID number of the ticket that the user is viewing.
Profile
  • clientarea.php?action=changepw
  • clientarea.php
  • \WHMCS\User\Client|null: client — The currently-authenticated client, or null if the visitor is not authenticated.

Last modified: November 19, 2024