Jump to content


  • Content count

  • Joined

  • Last visited

Community Reputation

4 Neutral

About namhost

  • Rank
  1. namhost

    Adding a menu item under "Logs"?

    Thanks for the input. I've decided to keep the log on the main module page, but only make it visible to superadmins!
  2. 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?
  3. 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?
  4. 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?
  5. 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?
  6. 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, ]); } } } });
  7. 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?
  8. namhost

    Adding a custom whois server?

    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.
  9. namhost

    Adding a custom whois server?

    Okay, I got it. This works: [ { "extensions": ".com.na,.alt.na,.co.na,.net.na,.edu.na,.org.na,.na", "uri": "http://XXXX/nawhois.php?d=", "available": "No Object Found" } ] I needed the ?d= ... otherwise it would create a url like so: nawhois.phpDOMAINNAME.COM instead of: nawhois.php?d=DOMAINNAME.COM Sorted! :-)
  10. namhost

    Adding a custom whois server?

    Okay, now I'm stumped. I added this to the server: [ { "extensions": ".com.na,.alt.na,.co.na,.net.na,.edu.na,.org.na,.na", "uri": "https://MYDOMAIN/nawhois.php", "available": "No Object Found" } ] I added it to /resources/domains/whois.json Nothing. There's also dist.whois.json. Should I maybe delete that? Or rather use dist.whois.json?
  11. namhost

    Adding a custom whois server?

    Nope. Not even if I put it on a server. It might work online, and not locally, but I want to make it work locally before putting it online. Any ideas on how to debug this? A way to check it's reading whois.json? Or perhaps to see what response it is getting from the whois?
  12. namhost

    Adding a custom whois server?

    It's honestly like whmcs isn't even aware of the whois.json file. Let me try a non-localhost url.
  13. namhost

    Adding a custom whois server?

    yeah, try as I may, it's not hitting my custom uri that I have specified... :(
  14. namhost

    Adding a custom whois server?

    That was just me copying and pasting the top bit quickly. Here's the actual code: [ { "extensions": ".com.na,.alt.na,.co.na,.net.na,.edu.na,.org.na,.na", "uri": "socket://whois.na-nic.com.na", "available": "No Object Found" } ] But that still doesn't work. I would prefer to use my own api, so it would be great if this could work: [ { "extensions": ".com.na,.alt.na,.co.na,.net.na,.edu.na,.org.na,.na", "uri": "http://localhost/nawhois.php", "available": "No Object Found" } ]
  15. I added a custom server like so in /resouces/domains/whois.json [ { "extensions": ".com.na,.alt.na,.co.na,.net.na,.edu.na,.org.na,.na", "uri": "http://localhost/nawhois.php", "available": "No Object Found" }, and in my php I just did this: <?php file_put_contents("./LOG", json_encode($_REQUEST)); But it's not even hitten this code. Must you do some sort of cache clear after adding whois.json?

Important Information

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