Inetbiz Posted September 22, 2011 Share Posted September 22, 2011 Can someone help build in this thread an API function call that gets tblclients user id, email, password when you know the cpanel user name in tblhosting? In building cpanel theming, you can store the current cpanel user like this: $cpusername = '<cpanel print="$user">'; unless that has changed in recent cpanel updates? 0 Quote Link to comment Share on other sites More sharing options...
sdemidko Posted September 22, 2011 Share Posted September 22, 2011 I would help you But before suggest you something explain pls how is cpanel username generated? I assume the client has hosting, hosting has primary domain, and cpanel username is usually generated based on this domain do you know how it is generated? lets say domain is mysuperdupersite.com what will be the username? or what if the domain is short, something like mysite.com, what will be the username then? btw, there is good tutorial for creating custom api functions http://www.visions.se/tutorials/creating-your-own-api-functions-for-whmcs/ 0 Quote Link to comment Share on other sites More sharing options...
Inetbiz Posted September 24, 2011 Author Share Posted September 24, 2011 If you insert the code in your cpanel template, it will output the current cpanel user. Has nothing to do with the domain name. 0 Quote Link to comment Share on other sites More sharing options...
sdemidko Posted September 24, 2011 Share Posted September 24, 2011 If you insert the code in your cpanel template, it will output the current cpanel user. Has nothing to do with the domain name. ok then how cpanel username can be connected to whmcs client profile? is cpanel username is stored anywhere in whmcs DB? 0 Quote Link to comment Share on other sites More sharing options...
jeremyhaber Posted September 24, 2011 Share Posted September 24, 2011 btw, there is good tutorial for creating custom api functionshttp://www.visions.se/tutorials/creating-your-own-api-functions-for-whmcs/ Simply creating a new api file in /includes/api/ will create a new API function accessible through the default API system or OAuth. Then to prevent access from any users you simple use a wrapper if statement: <?php /* Custom API Function Name the file all lowercase and with the command to call Save File To: /includes/api/ The following are defined by the WHMCS API: ROOTDIR is a constant that holds the absolute path of WHMCS install The file dbconnect.php is included. This establishes a mysql connection. The file includes/functions.php is included. This hold various WHMCS commands. */ if (!defined("WHMCS")) die("This file cannot be accessed directly"); # Your API Function goes here... ?> For returning values to the end user there should be an array called "$apiresults" which will automatically be phrased into xml or json depending on what you want to be returned. then how cpanel username can be connected to whmcs client profile?is cpanel username is stored anywhere in whmcs DB? The cPanel username and password are stored in the WHMCS database. The password is encrypted with the WHMCS encrypter. You can use the local API's EncryptPassword and DecryptPassword functions to work with those. 0 Quote Link to comment Share on other sites More sharing options...
sdemidko Posted September 24, 2011 Share Posted September 24, 2011 thanks for tips! it would be much better to have full documentation on how to create custom API functions in most cases we have to guess how whmcs is working and what functions are commonly used. encrypted code is evil 0 Quote Link to comment Share on other sites More sharing options...
jeremyhaber Posted September 24, 2011 Share Posted September 24, 2011 thanks for tips!it would be much better to have full documentation on how to create custom API functions in most cases we have to guess how whmcs is working and what functions are commonly used. encrypted code is evil No problem. Glad it helps, it is definitely a challenge finding out how some of these WHMCS functions work. But figuring it out is half the fun 0 Quote Link to comment Share on other sites More sharing options...
Inetbiz Posted September 24, 2011 Author Share Posted September 24, 2011 I think I'll wait for someone with experience to jump into this thread. It appears you don't have the experience. 0 Quote Link to comment Share on other sites More sharing options...
jeremyhaber Posted September 24, 2011 Share Posted September 24, 2011 Can someone help build in this thread an API function call that gets tblclients user id, email, password when you know the cpanel user name in tblhosting? In building cpanel theming, you can store the current cpanel user like this: $cpusername = '<cpanel print="$user">'; unless that has changed in recent cpanel updates? This kind of thing would be better off in the market place. Free help is typically something that may or may not help. You may only get little bits of information from free help. But paid help will definitely give you the solution you are looking for. I have definitely given you a bit of a start but you have to know how to code to build the API function as well as use it. 0 Quote Link to comment Share on other sites More sharing options...
sdemidko Posted October 1, 2011 Share Posted October 1, 2011 you was given a good tips to start from and you are waiting for a free help and someone with "better" experience, lol good luck! 0 Quote Link to comment Share on other sites More sharing options...
Inetbiz Posted October 1, 2011 Author Share Posted October 1, 2011 you was given a good tips to start fromand you are waiting for a free help and someone with "better" experience, lol good luck! There is NO need to begin flaming. It'll only make you look bad. 0 Quote Link to comment Share on other sites More sharing options...
Inetbiz Posted October 1, 2011 Author Share Posted October 1, 2011 Those functions should help you with the encrypting and decrypting of passwords.Thanks for the pointers on encryption. Pretty much am still studying the API to get their information when you have their cpuser IF you use cpanel =) Thanks again, though! 0 Quote Link to comment Share on other sites More sharing options...
jeremyhaber Posted October 2, 2011 Share Posted October 2, 2011 No problem. You can use the Get Clients Product API command to retrieve the username along with other information for the clients account. http://docs.whmcs.com/API:Get_Clients_Products 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.