Jump to content

WHMCS API get user id,pw, email when you know the hosting user name


Inetbiz

Recommended Posts

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?

Link to comment
Share on other sites

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/

Link to comment
Share on other sites

btw, there is good tutorial for creating custom api functions

http://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.

Link to comment
Share on other sites

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 ;)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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! ;)

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