Jump to content

display variables outside whmcs


minadreapta

Recommended Posts

what i want to do is display the client first name on a page outside the whmcs directory, if the client is logged in.

 

i did this:

 

<?php

 

require("whmcs_dir/dbconnect.php");

require("whmcs_dir/includes/functions.php");

require("whmcs_dir/init.php");

$firstname= $this->get_template_vars('clientsdetails.firstname');

 

 

if ($_SESSION['loggedinstatus']=="true") { echo "Welcome $firstname"; }

else { echo "Please Login"; }

 

?>

 

but $firstname= $this->get_template_vars('clientsdetails.firstname'); doesn't work.

 

any ideas on how to output the first name on a page outside whmcs?

Link to comment
Share on other sites

I ran into this the other day ;)

 

get_template_vars doesn't work properly. If it's setup as a sub-page of WHMCS (as it seems to be above) you should be able to access it directly with:

 

$firstname = $GLOBALS['clientsdetails']['firstname'];

 

Alternativly, i prefer this method which seems to have been created for integration purposes:

 

if (!empty($GLOBALS['clientsdetails']['id']))
{
	require_once ("./includes/clientfunctions.php");
	$userdetails = getclientsdetails($GLOBALS['clientsdetails']['id']);
}
$fullname= $userdetails['firstname']." ". $userdetails['lastname'];
$email = $userdetails['email'];

 

Note, the latter method is limited to those 3 variables from what i can tell. It seems to have been created specifically for the Kayako integration.

Link to comment
Share on other sites

  • 2 weeks later...

Do you mean Client Area Password? I'm not sure, but if the password is encrypted in the database (I think it is) then you won't be able to decrypt it, as the method used only works one way (Text > Encrpyted). So, you won't be able to show the password string itself.

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