Search the Community
Showing results for tags 'customfields'.
Found 8 results
-
``` } catch (Exception $e) { // Record the error in WHMCS's module log. logModuleCall( 'vps', __FUNCTION__, $params, $e->getMessage(), $e->getTraceAsString() ); return $e->getMessage(); } return 'success'; } /* testing code $data = array( 'error' => 'Custom error testing', 'success' => 'success', 'data' => $data ); return $data; } */ /* use WHMCS\Database\Capsule; ``` It's Lavarel framework https://developers.whmcs.com/advanced/db-interaction/ //This is example custom filed that i have on //product $vpsusername = $customfields['VPS Username']; /* Now I can enter and save VPS Username field in WHMCS client product admin area but I would like to automatically generate service username and password and update customfield value in database. By looking into database I found how is value of customfield saved. */ SELECT * FROM `tblcustomfieldsvalues` ORDER BY `tblcustomfieldsvalues`.`updated_at` DESC relid 216 Hello, I'm building custom server module for automatic vps setup based on client order. Main part is finished when order is accepted server building is started and everything is working great. Now I want to extend and improve module with new functions. 1. On module _Create i would like to update automatically generated service username and password and update that generated values to customfield values in database. How to do that and if it's even possible? 2. I have an issue where I can't get custom return in latest WHMCS update. Earlier you could return success or custom message. Now custom message is not accepted for some reason only success or error is . Question is how to get custom errors or custom return messages back from remote script. Only success is accepted as whmcs solution or I'm missing something. Thank you in advance
- 3 replies
-
- Custommodule
- return
-
(and 1 more)
Tagged with:
-
I hope someone has knowledge about this .. I find very little information about it. I hope someone helps me. I am trying to prevent users from being able to change some fields in their profile. I found the following function: https://developers.whmcs.com/hooks-reference/everything-else/#customfieldsave <?php add_hook('CustomFieldSave', 1, function($vars) { return array('value' => 'overridden value',); }); this prevents any field from being editable, however, how can I select a specific field? img: someone posted an idea in 2019. however it doesn't work, because fieldid and relid return NULL from $vars any idea? I just need to select the fields that I want to prevent from being edited.
-
I would want to access my product moduleConfigOption1 inside CustomFieldSave hook add_hook('CustomFieldSave', 1, function($vars) { $customFieldValue = \WHMCS\CustomField\CustomFieldValue::firstWhere([ 'fieldid' => $vars['fieldid'], 'relid' => $vars['relid'] ]); // this works $client = $customFieldValue->client; $customField = $customFieldValue->customField; $customFieldValue->service; // this is null $customField->product; // null here too }); According to the document https://classdocs.whmcs.com/8.1/WHMCS/CustomField/CustomFieldValue.html CustomFieldValue has a public property name service, but it's null in my code so I can't do this:
-
- whmcs8
- customfields
-
(and 1 more)
Tagged with:
-
provisioning Provisioning - Posting customfields to external DB
Jeronk posted a topic in Developer Corner
Good day, I require assistance with custom fields, I need to pass 4 custom fields inputs to an external database, array( '$params[‘customfields’][‘Username’]', '$params[‘customfields’][‘Email’]', '$params[‘customfields’][‘Cellphone Number’]', '$params[‘customfields’][‘Password’]', ); how do I use the above custom fields in a SQL query? Any assistance would be greatly appreciated, thanks.- 1 reply
-
- customfields
- custom
- (and 4 more)
-
Hello, I'm working on a python script and i'd like to insert customfields on the updateclient call. This is a json of tblcustomfields {"id":"2","type":"client","relid":"0","fieldname":"status","fieldtype":"dropdown","description":"","fieldoptions":"notVerified,verified","regexpr":"","adminonly":"on","required":"","showorder":"","showinvoice":"","sortorder":"0","created_at":"0000-00-00 00:00:00","updated_at":"0000-00-00 00:00:00"}, tblcustomfieldsvalues {"id":"5","fieldid":"2","relid":"297","value":"verified","created_at":"2019-11-05 04:38:50","updated_at":"2019-11-05 04:38:50"}, {"id":"6","fieldid":"3","relid":"297","value":"","created_at":"2019-11-05 04:38:50","updated_at":"2019-11-05 04:38:50"}, {"id":"7","fieldid":"4","relid":"297","value":"","created_at":"2019-11-05 04:38:50","updated_at":"2019-11-05 04:38:50"}, {"id":"8","fieldid":"6","relid":"297","value":"","created_at":"2019-11-05 04:38:50","updated_at":"2019-11-05 04:38:50"} Now when it comes to pushing the data, the documentation isn't clear. All i'm seeing is; customfields|string|Base64 encoded serialized array of custom field values|Optional Based on web searching, its not getting clearer. Here is a snipped of my last code. cstatus = { "fieldid": "2", "value": "verified" } encoded = base64.b64encode(b'cstatus') with requests.Session() as session_whmcs_bounces: session_whmcs_bounces.headers.update(whmcs_auth) whmcs_bounces_payload = { 'identifier': whmcs_ident, 'secret': whmcs_secret, 'responsetype': whmcs_response, 'action': "UpdateClient", 'clientemail': email, 'status': "Inactive", 'marketingoptin': 0, 'notes': '--- Bounces ---\nCreated: %s\nStatus: %s\nReason: %s\n---Bounces---' % (timeconvert,status,reason), 'customfields': encoded } i tried using the json.dumps/json.loads techniques to serialize the data, but in my mind i don't have to since the data is already serialized, i just have to encode it. I also tried variations, as in just the ID and value { "2": "verified" } / { "id": "2", "value": "verified" } and different combinations. Been at it for a few hours and can't seem to find much information. Ideally i'd like to update multiple sections based on the json reply. The flow i'm trying to achieve is this; Receive client information from datasource. { "email": "example@domain.tld", "type": "prospect", "status": "verified", "firstName": "Jon", "lastName": "Wong", "position": "Senior Linux Administrator", "sourcePage": "https:\/\/www.linkedin.com\/in\/jonthewong" } Add it or Update it into WHMCS Use extra fields as customfields. In this case, type/status/position/sourcepage The python code shown is for a separate part of the project, but the customfields base64,serialization still apply. If anyone has any experience or suggestions i'd appreciate it. Thank you. On a side note, I'm using Python 3.7 + requests/time/json/base64/getpass I'm open to adding other libs, but ideally i'd prefer using the ones i already have build for this env.
-
Hi all i need to solve a problem with a wrong invoice ( obv paid from my client ) due a wrong data insert in registration from client. in my 7.5 whmcs version there's checked "Store Client Data Snapshot" option and it's working correctly, i need so ( i think that is the only way ) modify wrong data from db table mod_invoicedata.customfields and mod_invoicedata.clientdetails but value that i need to change is into a big array and i don't know how touch correctly it. Someone has some suggestions or workaround to solve this problem that i think could be really common after whmcs upgrade system and changing ? Thank you so much. Regards
- 4 replies
-
- invoice
- customfields
-
(and 1 more)
Tagged with:
-
Hello how do I get the customfields values in gateway modules? Can I get the value of customFields by name? I did a lot of tries, but I didn't figured out... In Gateway config module I should set the ID of each customfield. Exemplo: ID Cutomer Field: 2 | Name: CPF ID Cutomer Field: 15 | Name: WhatsApp ID Cutomer Field: 19 | Name: moipCC print_r($params["clientdetails"]["customfields"]); Array ( [0] => Array ( [id] => 2 [value] => 222745448840 ) [1] => Array ( [id] => 15 [value] => 16994513223 ) [2] => Array ( [id] => 19 [value] => ) How do I get the value of ID Customer Field 15 without know the Array key. Thanks
-
Hello I'm trying to create a gateway payment integrate with whmcs credit card default system. In Gateway payment configs (admin/configgateways.php) I would like to set an option of each customfields with dropbox than input text. check the image: https://prnt.sc/jffxs1 I need to set it on method getwayname_config() check the image: https://prnt.sc/jffyap function GATEWAYNAME_config() { return array( // the dropdown field type renders a select menu of options 'dropdownField' => array( 'FriendlyName' => 'Dropdown Field', 'Type' => 'dropdown',//// HOW TO SHOW CUSTOMFIELDS INTO DROPDOWNFIELD? 'Options' => $params["clientdetails"]["customfields"], 'Description' => 'Choose one', )); } How to populate the dropdown field on admin payment gateway config with customsfields names? any help will great!!! thanks
- 5 replies
-
- customfields
- whmcs
-
(and 1 more)
Tagged with: