Jump to content

Custom Function for Domain Registrar module


Soft

Recommended Posts

Hi,

I would like to add Custom Function in my registrar module so I create function like this. (Ref. https://developers.whmcs.com/provisioning-modules/custom-functions/?search=Admin+Alert)

/* Custom Registrar Commands Button in Admin Page */
function mymodule_AdminCustomButtonArray() 
{
    $buttonarray = array(
            "My Custom Function" => "myCustomFunction",
    );
    return $buttonarray;
}

// Custom Function
function mymodule_myCustomFunction($params) 
{
    $result = "myCustomFunction";
    return $result;
}

I want to show message "myCustomFunction" when click "My Custom Function" button in registrar command section. But it show the message "The changes to the domain were saved successfully" instead.

How to return the response message as I want ? 

Thank you so much in advance for your help.

Link to comment
Share on other sites

  • 1 month later...
  • 3 months later...

Hi

If you want to display a custom message when clicking the "My Custom Function" button, you'll need to modify the code to trigger a custom action and display your desired message. Here's how you can achieve that:

php
Copy code
/* Custom Registrar Commands Button in Admin Page */
function mymodule_AdminCustomButtonArray() 
{
    $buttonarray = array(
        "My Custom Function" => "myCustomFunction",
    );
    return $buttonarray;
}

// Custom Function
function mymodule_myCustomFunction($params) 
{
    // Your custom action here
    $message = "Custom action was performed successfully";
    
    // You can use logActivity to log the custom action if needed
    logActivity("Custom action was performed by admin: " . $message);
    
    // Display the custom message
    return $message;
}
In this modified code, the mymodule_myCustomFunction function performs a custom action and sets the $message variable with the message you want to display. You can replace "Custom action was performed successfully" with your desired message.

If you have any doubts then check: https://codestoresolutions.com/

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