Jump to content


Senior Member
  • Content Count

  • Joined

  • Last visited

Community Reputation

4 Neutral

About namhost

  • Rank
  1. I also posted the same question on stack overflow here. Let's see which gets answers faster! :)
  2. I was able to create a simple addon module which now has public path = /index.php?m=mymodule&action=overview I would prefer if the url was /mymodule/overview I am using this will have to be done in htaccess and WHMCS can't deal with it by itself, or am I missing something?
  3. I also have this problem, and even if I click the generate button, I end up with this (see attached images). It's saying "0: Label is invalid". Anyone else come across this?
  4. I am creating my own custom form that allows a user to create content. I want to validate the input and display an error message if he did something wrong. This is for a module in the admin backend. 1. Is there a way to display an error message with PHP. I see there are "Notifications" but that is total overkill. I just want to manually trigger a success or error message. And then failing that: 2. Is there a built in way to do form with WHMCS? 3. Is there a way to deal with validation?
  5. I found this which allows me to add a fields during domain configuration. I used this to add a dropdown where the user can select: - Company - Individual I also have two other fields: - Company Name - Your Name Using conditional "Conditional Requirements", i was able to get add the code below to public_html/resources/domains/additionalfields.php: foreach ($domainExtensions as $domainExtension) { $additionaldomainfields[$domainExtension][$legalTypeLabel] = array( "Name" => $legalTypeLabel, "Type" => "dropdown", "Options" => '1|Company,2|Individual', "Required" => true, ); $additionaldomainfields[$domainExtension]["Company Name"] = array( "Name" => "Company Name", "Type" => "text", "Size" => "100", 'Required' => [ $legalTypeLabel => [1], ], ); $additionaldomainfields[$domainExtension]["Your Name"] = array( "Name" => "Your Name", "Type" => "text", "Size" => "100", 'Required' => [ $legalTypeLabel => [2], ], ); } This works great and gives me this (see attachment). So the problems I have: It's showing a * next to both fields - I expect it to only show the asterisk next to the field that is required. So therefore, at first it must show the one field as required, then the second But ideally, I want the whole field hidden when it's not required. So my questions: Is there a way to add custom javascript upon field generation that can handle the show and hide logic as needed? Or will I just have to add my own custom javascript somewhere else? And if so, where? Thanks!
  6. I have another use case to add that I explain here: In short, our clients have different pricing depending on the registrant. We also have resellers that register domains on behalf of their clients. So the reseller would order a domain, then they must specify their clients details, and then if that client has Country = My Country, then they get a much cheaper price than if they were outside of my country. And this is a rule the registrar as set for this domain, so I have to cater for it. Will that add on module help me with that too?
  7. We sell a domain type that has two different sets of pricing. If you register it as a local, you get a much cheaper price than if you register it as a non-local resident. I was able to get the two sets of pricing to work with "Client Groups", but the requirements are a bit tricky because we have resellers that also register domains on behalf of clients which can't be assigned to a client group. So that route won't work. Instead we need a way to: 1. specify on a DOMAIN LEVEL, whether or not that domain has "local" or "foreign" pricing, and a way to 2. Require the user to provide this and other registrant details as they add the domain to cart. Is there any module or code anyone can direct me to?
  8. Thanks for the input. I've decided to keep the log on the main module page, but only make it visible to superadmins!
  9. I created my own module whereby admins must be able to enable to module and configure it, but not necessarily other staff. So I left most of the config on the page where you enable the module. And only the parts that staff should see is on the page actual module page. However, I also want a page where logs can be viewed. But I also only want admins to see this. So adding it on the module page itself won't work, as staff can see that. Instead, I'm thinking I can just add a menu item on Utilities --> Logs --> My Log. Does anyone know how to add a page to this menu? is it possible?
  10. I made my own module with a custom field called "To Address" as shown here: $return['my_field'] = array ( 'FriendlyName' => 'My Email Field', 'Type' => 'text', 'Description' => 'bla bla', ); How can I add my own custom validation so that I can make sure: The email is valid and if it is, Execute an external service using the provided email address and show a notification if it is not valid Does anyone know how to add custom validation like this?
  11. I am creating a module and I want the flow for the configuration to be as follows: The first line item must be: [ ] Enable API Only if this checkbox is clicked, must the next field appear: API Key: ______________________________________ Is there an inherent way to do this? Or will I need to use javascript to show and hide the fields as needed? And if so, how do you add javascript to the admin backend? Is that possible?
  12. I'm sure it is possible, because by default any module has what you can see in the attachment. So, I can add a single checkbox like so: 'mymod_maintenance_mode' => [ 'FriendlyName' => 'Maintenance Mode', 'Type' => 'yesno', 'Description' => 'Tick to temporarily disable all notifications.', ], But let's say I wanted two checkboxes: Disable Maintenance Mode Disable Backend Access For Non Super Admins How would I be able to get multiple checkboxes to appear in the same way WHMS makes it appear for the "Access Control" settings?
  13. For anyone that might be interested: <?php if (!defined("WHMCS")) die("This file cannot be accessed directly"); use WHMCS\ClientArea; use WHMCS\Database\Capsule; /* * Before registering a domain name, this will change the company name * from: * ABC INC [[123]] * to: * ABC INC * i.e. Removes the [[123]] */ add_hook('PreRegistrarRegisterDomain', 1, function($vars) { if (!empty($vars['params']['userid'])) { $userid = $vars['params']['userid']; $client = Capsule::table('tblclients') ->where('id', $userid) ->first(); if (!empty($client->companyname)) { if (strpos($client->companyname, '[[') !== false && strpos($client->companyname, ']]') !== false) { $newName = $client->companyname; $newName = substr($newName, 0, strpos($newName, '[[')); $newName = trim($newName); Capsule::table('tblclients') ->where('id', $userid) ->update([ 'companyname' => $newName, ]); } } } }); add_hook('AfterRegistrarRegister', 1, function($vars) { if (!empty($vars['params']['userid'])) { $userid = $vars['params']['userid']; $client = Capsule::table('tblclients') ->where('id', $userid) ->first(); if (!empty($client->companyname)) { if (strpos($client->companyname, '[[') !== false && strpos($client->companyname, ']]') !== false) { // name already contains [[]] } else { $newName = $client->companyname; $newName = $newName.' [['.$userid.']]'; $newName = trim($newName); Capsule::table('tblclients') ->where('id', $userid) ->update([ 'companyname' => $newName, ]); } } } });
  14. I am trying to find a hook that will allow me to alter the company name BEFORE it is sent for registration. For example, if the user's company name is: ABC INC [[123]] I want to modify it, so that it is only: ABC INC Another billing module I use unfortunately requires that I modify the user's company name to include his user id in this way. But I don't want that user id portion to appear on whois records. So I want to modify it before it is sent off for registration. I have started browsing though these: https://developers.whmcs.com/hooks-reference/domain/ ... but perhaps someone else can steer me in the right direction?
  15. I use CompleteAPI.com for the whois query. So my original plan was to have a script that calls completeapi. But I was able to set it up so that it is called directly like so: [ { "extensions": ".com.na,.alt.na,.co.na,.net.na,.edu.na,.org.na,.na", "uri": "https://www.completeapi.com/v1/[MY_API_KEY]/whois/", "available": "No Object Found" } ] I'm sure something similar can be achieved with other whois apis. The trick for me was going to the admin area and using the whois there. That showed me the output and I was able to debug it. And that is how I found out I needed the query string part.
  • 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