Jump to content

How to send data of a customer from form


youki

Recommended Posts

Hello,

i don't know WHMCS and we want to implement the function that a customer can request an Active Directory Account.

Do we need an addon for that?  

I want the following steps:

1. User can enter the required information in corresponding fields/ controls (textboxes, dropdowns, checkboxes) .

2. User sends the request by button.

3. We confirm the request by button and the data will be send automatically to the active directory (by hook?!).

Any tutorial?

Regards

 

 

 

Link to comment
Share on other sites

Could you change it to the following questions?

1. I need to send data of a pending order by the "accept order" button to a domain controller.

  • Where do i get the data  from (database?) and do i need a hook to query the data that i can  send it to the domain controller ? (How to send it, by hook?)

2. I need to query the domain controller for a value (active account) to show it on the product details page, how can i do it? (It has to be refreshed every time the user opens the details page)

 

Regards

Link to comment
Share on other sites

Hello,

I don't get any further.

How can i access the nested order data by key? 

I've tried it also with the json. I only get the first 4 values like: success101

Regards

 

<?php

use WHMCS\Database\Capsule;

add_hook('AcceptOrder', 1, function($vars)
{
      // Get current order id.
     $orderID = $vars['orderid'];

     $command = 'GetOrders';
     $postData = array(
     'id' => $orderID,
);

$adminUsername = 'xxx'; // Optional for WHMCS 7.2 and later
$results = localAPI($command, $postData, $adminUsername);


$filename = "/WHMCS_TEST/Testfile.txt";
   
$f = fopen($filename, 'wb');
if (!$f) {
die('Error creating the file ' . $filename);
}
   
//INFO - JSON Structure: GetOrders - WHMCS Developer Documentation
$json = json_encode(array('data' => $results));

foreach($results as $result)
{
     fputs($f, $result);

foreach($result as $orders)
{
     fputs($f, $orders);

foreach($orders as $order)
{
     $test = $order;
     fputs($f, $test);
}
}
}

fclose($f);
});

 

 

 

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