Jump to content

Add client custom field through API


ipaddress

Recommended Posts

This sniplet should work for you to update your customfields

Just add it in to your existing code where you define the postfields

$customfields = array(
   '1stcustomfieldname' => "1st customfield value",
   '2ndcustomfieldname' => "2nd customfield value",
   '3rdcustomfieldname' => "3rd customfield value",
);
$postfields["customfields"] = base64_encode(serialize($customfields));

Link to comment
Share on other sites

  • 5 months later...

ok, but how it will look like if in form I have inputs with 12 months:

 

 

<select name="customfield[9]"><option value="Month">Month</option><option value=" January"> January</option><option value=" February"> February</option><option value=" March"> March</option><option value=" April"> April</option><option value=" May"> May</option><option value=" June"> June</option><option value=" July"> July</option><option value=" August"> August</option><option value=" September"> September</option><option value=" October"> October</option><option value=" November"> November</option><option value=" December"> December</option></select>

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 year later...
This sniplet should work for you to update your customfields

Just add it in to your existing code where you define the postfields

$customfields = array(
   '1stcustomfieldname' => "1st customfield value",
   '2ndcustomfieldname' => "2nd customfield value",
   '3rdcustomfieldname' => "3rd customfield value",
);
$postfields["customfields"] = base64_encode(serialize($customfields));

 

 

Hi sparky, I have the similar issue. I tried the above code but it didn't add any custom values. I tried the sample code from WHMCS API. Here are the post fields:

 

$postfields["action"] = "addclient";

$postfields["firstname"] = "Test";

$postfields["lastname"] = "User";

$postfields["companyname"] = "WHMCS";

$postfields["email"] = "demo@whmcs.com";

$postfields["address1"] = "123 Demo Street";

$postfields["city"] = "Demo";

$postfields["state"] = "Florida";

$postfields["postcode"] = "AB123";

$postfields["country"] = "US";

$postfields["phonenumber"] = "123456789";

$postfields["password2"] = "demo";

$postfields["currency"] = "1";

 

$customfields = array(

'CUSTOMFIELDS1' => "127.0.0.1",

'CUSTOMFIELDS2' => "localhost"

);

 

$postfields["customfields"] = base64_encode(serialize($customfields));

 

 

 

I.v been trying for couple of days to figure it out. But still no luck.

 

Can you please help? Thanks in advance.

 

[Edit]: The response what I am getting regarding that client is:

 

[CLIENT] => Array

(

[uSERID] => 35

[iD] => 35

[FIRSTNAME] => Test

[LASTNAME] => User

[COMPANYNAME] => WHMCS

=> demo@whmcs.com

[ADDRESS1] => 123 Demo Street

[ADDRESS2] =>

[CITY] => Demo

[sTATE] => Florida

[postCODE] => AB123

[COUNTRY] => US

[COUNTRYNAME] => United States

[PHONENUMBER] => 123456789

[NOTES] =>

[PASSWORD] => ee61ea3aa1706328bcf73fb3b10f0def:(KjMa

[CURRENCY] => 1

[CCTYPE] =>

[CCLASTFOUR] =>

[sECURITYQID] => 0

[sECURITYQANS] =>

[GROUPID] => 0

[sTATUS] => Active

[CREDIT] => 0.00

[TAXEXEMPT] =>

[LATEFEEOVERIDE] =>

[OVERIDEDUENOTICES] =>

[sEPARATEINVOICES] =>

[DISABLEAUTOCC] =>

[LANGUAGE] =>

[LASTLOGIN] => Date: 22/09/2011 13:32<br>IP Address: 205.251.135.186<br>Host: webhostingbuzz.com

[CUSTOMFIELDS1] =>

[CUSTOMFIELDS2] =>

[bILLINGCID] => 0

[CURRENCY_CODE] => GBP

)

 

-Mahmudul

Edited by Mahmudul
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