Jump to content

PUQ

Member
  • Content Count

    19
  • Joined

  • Last visited

Community Reputation

0 Neutral

About PUQ

  • Rank
    Junior Member
  1. To loop through the roles and generate the checkboxes dynamically, you can use a PHP foreach loop to iterate over an array of roles and create the checkboxes inside the loop. Here is an example of how you could do this: function leave_module_config() { $roles = ['role1', 'role2', 'role3', 'role4']; $fields = [ 'Checkbox Field Name' => [] ]; foreach ($roles as $role) { $fields['Checkbox Field Name'][] = [ 'FriendlyName' => $role, 'Type' => 'yesno', 'Description' => 'Tick to enable', ]; } return [ 'fields' => $fields ]; } This code will create a checkbox for each role in the $roles array. The FriendlyName for each checkbox will be set to the corresponding role name, and the Type and Description will be set to the same values for all checkboxes. You can modify this code to suit your specific needs, such as by adding additional fields or by generating the role names and IDs dynamically from a database or other source.
  2. The tblsslorders table in WHMCS is used to store information about SSL certificate orders. It contains a record for each SSL certificate that is ordered through WHMCS, including the status of the order and details about the certificate. The table has the following structure: CREATE TABLE `tblsslorders` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `userid` int(10) unsigned NOT NULL, `serviceid` int(10) unsigned NOT NULL, `remoteid` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `module` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `certtype` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `status` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `completiondate` datetime DEFAULT NULL, `csr` longtext COLLATE utf8_unicode_ci, `cert` longtext COLLATE utf8_unicode_ci, `ca_cert` longtext COLLATE utf8_unicode_ci, `fullchain` longtext COLLATE utf8_unicode_ci, `privatekey` longtext COLLATE utf8_unicode_ci, `configdata` longtext COLLATE utf8_unicode_ci, `crt_created` datetime DEFAULT NULL, `crt_expires` datetime DEFAULT NULL, `crt_date_installed` datetime DEFAULT NULL, `dec_csr` longtext COLLATE utf8_unicode_ci, `dec_privatekey` longtext COLLATE utf8_unicode_ci, `webservertype` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `domain` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `validation` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `sslconfigid` int(11) DEFAULT NULL, `domains` longtext COLLATE utf8_unicode_ci, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; The id field is an auto-incrementing primary key that is used to uniquely identify each SSL certificate order. The userid and serviceid fields contain the ID of the user and service (e.g. hosting account) associated with the order, respectively. The remoteid field is used to store the unique ID of the SSL certificate as returned by the certificate authority (CA). The module field contains the name of the module that was used to process the order. The certtype field specifies the type of SSL certificate that was ordered. The status field indicates the current status of the order (e.g. "Pending", "Active", "Expired", etc.). The completiondate field contains the date and time when the order was completed. The csr field contains the certificate signing request (CSR) that was submitted with the order. The cert, ca_cert, and fullchain fields contain the SSL certificate, the CA certificate, and the full certificate chain, respectively. The privatekey field contains the private key associated with the certificate. The configdata field contains any additional configuration data that was specified when the order was placed. The crt_created, crt_expires, and crt_date_installed fields contain the dates and times when the certificate was created, when it expires, and when it was installed, respectively. The dec_csr and dec_privatekey fields contain the decrypted versions of the CSR and private key, respectively. The webservertype field indicates the type of web server for which the certificate is intended. The domain field contains the domain name for which the certificate was issued. The validation field indicates the type of validation that was performed to verify the certificate request. The sslconfigid field contains the ID of the SSL configuration that was used to process the order. The domains field contains a list of all the domains that are covered by the certificate. In general, the tblsslorders table is used to store information about SSL certificate orders that are placed through WHMCS. This information can be used to track the status of orders, retrieve certificates and other data, and perform other operations related to SSL certificates.
  3. To show an error message in the client area, you can use the returnError method of the $response object in your registrar module. This method allows you to specify an error code and a message to be displayed to the user. Here's an example of how you can use the returnError method to display an error message in the client area: $response = new WHMCS\Module\Server(); $response->returnError('2301', 'Object not pending transfer (domain.com)'); This code will display an error message with the code "2301" and the message "Object not pending transfer (domain.com)" to the user. In your specific case, it looks like you are trying to display an error message that includes both the error code and the message returned by the registrar. To do this, you can use the $response->returnError method and pass it the relevant values from the $params array: $response = new WHMCS\Module\Server(); $response->returnError($params['result']['value']['oxrs:xcp'], $params['result']['msg']['$t']); This code will extract the error code and message from the $params array and pass them to the returnError method, which will display them to the user.
  4. In WHMCS, you can add a custom route for a provisioning module by modifying the module's configuration file. The configuration file is a PHP script that is located in the modules/servers/ directory in your WHMCS installation. To add a route for a provisioning module, you will need to specify a $_ADDONLANG['route'] variable in the module's configuration file. This variable should contain an array of route definitions, where each definition consists of a key-value pair. The key represents the name of the route, and the value represents the route pattern. Here's an example of how you can define a route in a provisioning module's configuration file: $_ADDONLANG['route'] = array( 'payment/intent' => '/stripe/payment/intent', ); This route definition would allow you to access the route at https://domain.com/index.php?rp=/stripe/payment/intent. In addition to defining the route, you will also need to implement the code that handles the request when the route is accessed. This can be done by creating a function in the module's PHP code and registering it as a hook. For example: function stripe_payment_intent($vars) { // your code here } add_hook('ModuleRoutes', 1, 'stripe_payment_intent'); The stripe_payment_intent function will be called whenever the route /stripe/payment/intent is accessed, and it will receive an array of variables as its argument. You can use these variables to perform any necessary actions or operations in response to the request.
  5. It looks like you are encountering an error when attempting to establish a database connection in your PHP code. The error message mentions the tblerrorlog table, which suggests that the issue may be related to a logging system that is capturing errors and storing them in a database table. Based on the code snippet you provided, it appears that you are using the Laravel framework and its database component, called Eloquent. The useCurrentConnection method appears to be trying to check whether a database connection has already been established using Eloquent, and if so, it attempts to use that connection. If no connection is found, it creates a new connection using the self::$_instance = new self(); line. It is possible that the issue you are experiencing is related to an error that is occurring when trying to establish a new database connection. This could be due to a variety of factors, such as incorrect database credentials, a misconfigured database server, or a connectivity issue. To troubleshoot this issue, you could try the following steps: Check the database credentials that you are using to ensure that they are correct. This includes the database host, username, password, and database name. Verify that your database server is running and accessible. This could involve checking the status of the database service, checking firewall rules, or ensuring that the server is reachable from the machine where your code is running. Check the tblerrorlog table to see if there are any error messages or stack traces that might provide more information about the issue you are experiencing. Try establishing a manual database connection using a tool such as MySQL Workbench or the mysql command-line client to see if the issue is specific to your code or if it is a general connectivity issue. If you are using a framework such as Laravel, check the documentation or forums for any known issues or troubleshooting tips that might be relevant to your situation.
  6. To update a custom field for a client record on the "ClientEdit" hook, you can use the update_client_custom_field function provided by WHMCS. Here's an example of how you can use it: use WHMCS\Database\Capsule; // Update the custom field with field ID 1 for client with client ID 123 $success = Capsule::table('tblcustomfieldsvalues') ->where('fieldid', 1) ->where('relid', 123) ->update(['value' => 'new value']); if ($success) { // Custom field update was successful } else { // Custom field update failed } Note that you will need to replace 1 with the ID of the custom field you want to update, and 123 with the ID of the client whose custom field you want to update. You will also need to replace 'new value' with the new value you want to set for the custom field. You can use this code in the "ClientEdit" hook function, which is called whenever a client record is edited in the WHMCS admin area or by the client using the client area.
  7. In a payment gateway module for WHMCS, you can access the billing cycle for an order using the $params variable, which is passed to the payment gateway's capture function as an argument. The $params variable is an array that contains various information about the order, including the billing cycle. To access the billing cycle for an order in a payment gateway module, you can use the following code: $billingCycle = $params['billingcycle']; The $billingCycle variable will contain a string value representing the billing cycle for the order, such as "Monthly", "Quarterly", "Semi-Annually", or "Annually". You can then use the $billingCycle variable to make any necessary changes to the payment gateway request or response based on the billing cycle.
  8. To update data in the client area every 5-10 seconds, you can use JavaScript and the setInterval function to periodically send an AJAX request to your module and retrieve the updated data. Here is an example of how you can do this:In your module, create a function that returns the data you want to display in the client area as a JSON-encoded string. For example: function mymodule_get_data($vars) { // Get data from your server or other source $data = array( 'cpu_usage' => 50, 'memory_usage' => 75, // ... other data here ); return json_encode($data); } In your module's client area template, add a JavaScript script that uses the setInterval function to send an AJAX request to your module's mymodule_get_data function every 5-10 seconds. For example: <script> setInterval(function() { // Send an AJAX request to your module's mymodule_get_data function $.ajax({ url: '/modules/servers/mymodule/getdata.php', type: 'POST', dataType: 'json', success: function(response) { // Update the data in the client area using the response from the server $('#cpu_usage').text(response.cpu_usage + '%'); $('#memory_usage').text(response.memory_usage + '%'); // ... other data here } }); }, 5000); // update every 5 seconds </script> In your module's getdata.php file, add the following code to handle the AJAX request and return the data from your mymodule_get_data function: <?php // Load WHMCS environment require_once __DIR__ . '/init.php'; // Get data from your module's mymodule_get_data function $data = mymodule_get_data($vars); // Return the data as a JSON-encoded string echo $data; exit; This should allow you to update the data in the client area every 5-10 seconds using an AJAX request to your module.
  9. Yes, it is possible to define custom variables in your WHMCS templates to simplify your template files and make them easier to manage. There are a few different ways you can do this, depending on where you want to use the variables and what type of data you want to store in them. One way to define custom variables is to use the assign function in your template files. For example, you can define a custom variable called promoVideo like this: {assign var='promoVideo' value='https://www.youtube.com/watch?v=dQw4w9WgXcQ'} You can then use this variable in your template like this: <div class="promo-video"> <iframe src="{$promoVideo}" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> </div> Another way to define custom variables is to use the set_template_var function in a custom hook or module function. For example, you can define a custom variable called additionalFeatures like this: function mymodule_additional_features($vars) { $additionalFeatures = array('Feature 1', 'Feature 2', 'Feature 3'); set_template_var('additionalFeatures', $additionalFeatures); } add_hook('ClientAreaPage', 1, 'mymodule_additional_features'); You can then use this variable in your template like this: <ul class="list-additional-features"> {foreach $additionalFeatures as $feature} <li>{$feature}</li> {/foreach} </ul>
  10. It looks like you are trying to use the WHMCS API to retrieve a list of tickets from your WHMCS installation. There could be a few reasons why you are getting null values in the response. Here are a few things you can try: Make sure you have entered the correct URL for your WHMCS installation in the $whmcsUrl variable. This should be the base URL for your WHMCS installation, including the http:// or https:// prefix, but not including the /includes/api.php part. Make sure you have entered the correct API identifier, secret, and access key in the $api_identifier, $api_secret, and $api_accesskey variables, respectively. These values can be found in the "API Credentials" section of the "Setup > General Settings > Security" page in the WHMCS admin area. Make sure the IP address of the server that you are running this script on is added to the list of allowed IP addresses in the "API IP Access Restriction" section of the "Setup > General Settings > Security" page in the WHMCS admin area. Make sure you are using the correct action name in the action parameter of your API request. In this case, you are using the GetTickets action, which should return a list of tickets. However, if you want to retrieve a specific ticket, you can use the GetTicket action and specify the ticketid parameter with the ID of the ticket you want to retrieve. Make sure you are using the correct response type in the responsetype parameter of your API request. In this case, you are using the json response type, which will return the response as a JSON-encoded string. If you want to receive the response as an array, you can use the array response type instead.
  11. To fix this problem, you can use the andWhere method to specify multiple conditions in the where clause, like this: foreach (Capsule::table('tblhosting') ->where("domainstatus", "=", "Active") ->andWhere("server", "=", "23") ->get() as $hosting) { // your code here } Alternatively, you can use the where method multiple times to specify multiple conditions, like this: foreach (Capsule::table('tblhosting') ->where("domainstatus", "=", "Active") ->where("server", "=", "23") ->get() as $hosting) { // your code here } Either of these approaches should allow you to specify multiple conditions in the where clause of your query.
  12. It looks like you are trying to use the Addon Feature mode in WHMCS to allow customers to purchase additional features for a product or service. In WHMCS, an Addon is a product or service that can be added to a primary product or service as an additional purchase. The Addon Feature mode allows you to create Addons that are linked to a specific product or service and are only available for purchase when the primary product or service is purchased. To use the Addon Feature mode in your own module, you will need to implement the following hooks in your module: CreateProductAddon: This hook is called when a new Addon is created in the WHMCS admin area. It allows you to define the Addon's name, description, and other details. ProductAddonActivate: This hook is called when an Addon is activated for a specific product or service. It allows you to perform any necessary actions to enable the Addon for the product or service. ProductAddonSuspend: This hook is called when an Addon is suspended for a specific product or service. It allows you to perform any necessary actions to disable the Addon for the product or service. ProductAddonTerminate: This hook is called when an Addon is terminated for a specific product or service. It allows you to perform any necessary actions to remove the Addon from the product or service.
  13. It's that time of year again! Black Friday is upon us and that means big savings on WHMCS modules. If you're looking to add some new features to your WHMCS installation or just save some money, this is the perfect opportunity. We have a wide selection of modules on sale, so there's sure to be something for everyone. Whether you're looking for a new payment gateway, a better way to manage your clients, or just some general enhancements, we've got you covered. So don't wait – take advantage of our Black Friday deals today! Pick the module in our shop and use this Promo Code: BF80
  14. To issue an invoice ahead of time for the service is necessary. On the main tab of information about the client "Summary". Select the desired product or service and click the "Invoice Selected Items" button
  15. Its quite rare case but You are correct - you should use Billable Items and define date.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated