Jump to content
  • 0

Custom Registrar Module


iacaro

Question

Hi,

We are using a custom registrar module to manage some domains.

Recently we added 3 options to the client area that allow customers directly accept, reject or cancel a domain transfer.

We would like to show to the customer in the client area the error returned from the registrar, so we´re using this:

Array
(
    [result] => Array
        (
           

 => 2301
            [msg] => Array
                (
                    [lang] => en-US
                    [$t] => Object not pending transfer
                )

            [value] => Array
                (
                    [xmlns:oxrs] => urn:afilias:params:xml:ns:oxrs-1.1
                    [oxrs:xcp] => 2301:Object not pending transfer (domain.com)
                )

        )

but no message is returned in the client area. The idea is to show them the same message we get if we hit these buttons from the admin area, i e: Registrar Error
An error ocurred | CODE: 2301 | MESSAGE: | 2301:Object not pending transfer (domain.com)

We added this function to the registrar module:

function registrarmodule_ClientArea($params)
{
    logModuleCall('registrarmodule', 'ClientArea', 'params', $params);

    $output = '';

    return $output;
}

but its not returning anything. 

Not sure where to turn here.

Thanks.

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

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.

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
Answer this question...

×   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