Member Function Renewal Errors
On this page
Problem
A Call to a member function
error displays in the Client Area for some users:
Error: Call to a member function getOnDemandRenewalSettings() on null in /path/to/whmcs/vendor/whmcs/whmcs-foundation/lib/User/Client.php:0
or
Error: Call to a member function enabledMetrics() on null in /path/to/whmcs/vendor/whmcs/whmcs-foundation/lib/Service/Service.php:0
Cause
The user’s current client has an orphaned service. An orphaned service is a service for a product that does not exist.
The system does not allow admins to delete products that have an associated service, indicating that someone deleted the data directly from the MySQL® database.
Troubleshooting
Run the following query on your WHMCS MySQL database to identify the orphaned services. You can do this using a tool like phpMyAdmin:
SELECT * FROM `tblhosting` WHERE `packageid` NOT IN (select id from tblproducts)
Solution
To fix this, assign the orphaned services to a product:
In the WHMCS Admin Area, go to Configuration () > System Settings > Products/Services.
Click Create a New Product.
Enter a product name (for example,
Orphaned Service
).Click Continue.
Note the package ID that displays in the URL in your browser’s URL bar:
Package ID 28
Run this MySQL query to assign the orphaned services to the newly-created product, replacing XX with the package ID from the URL:
UPDATE tblhosting SET packageid='XX' WHERE packageid NOT IN (SELECT id FROM tblproducts);
Last modified: October 29, 2024