Jump to content

Custom command buttons in registrar module?


thernes

Recommended Posts

Hi all

 

We have discovered an error in a custom built registrar module that has added an extra year to the next due date in our DB whenever a domain has been registered/transfered/renewed by this module.

 

I was planning to just add a custom button with a function that would correct this to the Registrar commands that are available, but it seems that this is not possible? After reading the doc, only the functions found here seems to be supported:
http://docs.whmcs.com/Registrar_Module_Developer_Docs?

 

I would appreciate if somebody can confirm that it is not possible to add new, custom buttons to the registrar commands or help me out with a small hint on how it is done, if it is possible to do this?

 

Thanks,

 

Thomas

 

Link to comment
Share on other sites

It doesn't appear to be listed in the docs but you can add a custom command/button by adding a AdminCustomButtonArray function in your registrar module and map the button name to a custom function name.

 

function modulename_AdminCustomButtonArray() {
   $buttonarray = array(
 "Fix next due date" => "fixduedate",
);
return $buttonarray;
}

Link to comment
Share on other sites

  • 3 weeks later...

I'm not sure why it isn't displaying for you guys but it does work for me with 5.1.2, here is example of adding a custom button to the email registrar module. The button doesn't actually do anything in this example, it just displays:

 

<?php

function email_getConfigArray() {
$configarray = array(
    "FriendlyName" => array("Type" => "System", "Value"=>"Email Notifications"),
    "Description" => array("Type" => "System", "Value"=>"This module can be used for any TLDs that have no integrated registrar"),
 "EmailAddress" => array( "Type" => "text", "Size" => "40", "Description" => "Enter the email address notifications should be sent to", ),
);
return $configarray;
}

function email_AdminCustomButtonArray() {
   $buttonarray = array(
 "Fix next due date" => "fixduedate",
);
return $buttonarray;
}

function email_RegisterDomain($params) {
global $CONFIG;
$command = "Register Domain";
$message = "Domain: ".$params["sld"].".".$params["tld"]."<br>Registration Period: ".$params["regperiod"]."<br>Nameserver 1: ".$params["ns1"]."<br>Nameserver 2: ".$params["ns2"]."<br>Nameserver 3: ".$params["ns3"]."<br>Nameserver 4: ".$params["ns4"]."<br>RegistrantFirstName: ".$params["firstname"]."<br>RegistrantLastName: ".$params["lastname"]."<br>RegistrantOrganizationName: ".$params["companyname"]."<br>RegistrantAddress1: ".$params["address1"]."<br>RegistrantAddress2: ".$params["address2"]."<br>RegistrantCity: ".$params["city"]."<br>RegistrantStateProvince: ".$params["state"]."<br>RegistrantCountry: ".$params["country"]."<br>RegistrantPostalCode: ".$params["postcode"]."<br>RegistrantPhone: ".$params["phonenumber"]."<br>RegistrantEmailAddress: ".$params["email"]."<br>AdminFirstName: ".$params["adminfirstname"]."<br>AdminLastName: ".$params["adminlastname"]."<br>AdminOrganizationName: ".$params["admincompanyname"]."<br>AdminAddress1: ".$params["adminaddress1"]."<br>AdminAddress2: ".$params["adminaddress2"]."<br>AdminCity: ".$params["admincity"]."<br>AdminStateProvince: ".$params["adminstate"]."<br>AdminCountry: ".$params["admincountry"]."<br>AdminPostalCode: ".$params["adminpostcode"]."<br>AdminPhone: ".$params["adminphonenumber"]."<br>AdminEmailAddress: ".$params["adminemail"]."";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: ".$CONFIG["CompanyName"]." <".$CONFIG["Email"].">\r\n";
return array( 'error' => '' );
}

function email_TransferDomain($params) {
global $CONFIG;	
$command = "Transfer Domain";
$message = "Domain: ".$params["sld"].".".$params["tld"]."<br>Registration Period: ".$params["regperiod"]."<br>Transfer Secret: ".$params["transfersecret"]."<br>RegistrantFirstName: ".$params["firstname"]."<br>RegistrantLastName: ".$params["lastname"]."<br>RegistrantOrganizationName: ".$params["companyname"]."<br>RegistrantAddress1: ".$params["address1"]."<br>RegistrantAddress2: ".$params["address2"]."<br>RegistrantCity: ".$params["city"]."<br>RegistrantStateProvince: ".$params["state"]."<br>RegistrantCountry: ".$params["country"]."<br>RegistrantPostalCode: ".$params["postcode"]."<br>RegistrantPhone: ".$params["phonenumber"]."<br>RegistrantEmailAddress: ".$params["email"]."";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: ".$CONFIG["CompanyName"]." <".$CONFIG["Email"].">\r\n";
mail($params["EmailAddress"],$command,$message,$headers);
}

function email_RenewDomain($params) {
global $CONFIG;
$command = "Renew Domain";
$message = "Domain: ".$params["sld"].".".$params["tld"]."<br>Registration Period: ".$params["regperiod"]."";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: ".$CONFIG["CompanyName"]." <".$CONFIG["Email"].">\r\n";
mail($params["EmailAddress"],$command,$message,$headers);
}

?>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • 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