mknjhill Posted August 18, 2013 Share Posted August 18, 2013 (edited) I have been sent to the wiki countless times.. I asked for ONE example with a good explanation on how to display a logged in users email address on a custom page! here is the response i got "Regrettably that's not something we can advise. For further assistance customising WHMCS feel free to consult with our friendly community of experts in our Customisation & Integration forum at http://forum.whmcs.com/ Regrettably we cannot assist with customisations here as part of product technical support." well here I am!! Can someone please show me an example of how to add a whmcs template variable, and explain it to me please and thank you. - you can use my example and show me how to display a users email address, OR if you prefer make me do that and learn something (witch ultimately that is what i want) but please, 1 example and explanation, and maybe answer a question or two.. I appreciate it. Edited August 18, 2013 by mknjhill editing 0 Quote Link to comment Share on other sites More sharing options...
jclarke Posted August 19, 2013 Share Posted August 19, 2013 A good place to start is in the WHMCS documentation, here they provide a sample custom page. http://docs.whmcs.com/Creating_Pages To get the users email address, all you need to do is modify the query that looks up the current user based on the logged in userid and then assign a new template variable which contains the email address. Here is a quick modification that just adds the email address as {$email} <?php define("CLIENTAREA",true); //define("FORCESSL",true); // Uncomment to force the page to use https:// require("init.php"); $ca = new WHMCS_ClientArea(); $ca->setPageTitle("Your Page Title Goes Here"); $ca->addToBreadCrumb('index.php',$whmcs->get_lang('globalsystemname')); $ca->addToBreadCrumb('mypage.php','Your Custom Page Name'); $ca->initPage(); //$ca->requireLogin(); // Uncomment this line to require a login to access this page # To assign variables to the template system use the following syntax. # These can then be referenced using {$variablename} in the template. $ca->assign('variablename', $value); # Check login status if ($ca->isLoggedIn()) { # User is logged in - put any code you like here # Here's an example to get the currently logged in clients first name $result = mysql_query("SELECT firstname,email FROM tblclients WHERE id=".$ca->getUserID()); $data = mysql_fetch_array($result); $clientname = $data[0]; $ca->assign('clientname', $clientname); $ca->assign('email', $data['email']); } else { # User is not logged in } # Define the template filename to be used without the .tpl extension $ca->setTemplate('mypage'); $ca->output(); ?> 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.