Jump to content

Checking if account has active SSL from clientareahome.tpl


Jomart_123

Recommended Posts

I'm doing some minor changes to our client clientareahome.tpl to display list of available hosting services associated with this user no client area home page, using the {$customerHostingData} that is already available on the page through a hook,

<?php
use Illuminate\Database\Capsule\Manager as Capsule;

function hook_pullingLastCustomerWebsite($vars){

	$client = Menu::context('client');
	$hostingData = Capsule::table('tblhosting')
			->where('userid', $client->id)
			->where('domain','<>','')
            ->select('id','domain','domainstatus','packageid')
            ->orderBy('id', 'DESC')
            ->get();
                       
	$encodedata = json_encode($hostingData);
	$decodedata = json_decode($encodedata, true);

	return array("customerHostingData" => $decodedata);
}
add_hook("ClientAreaPageHome", 1, "hook_pullingLastCustomerWebsite");

 

i was able to loop through the {$customerHostingData} array as {$site} and display all the information i need my customers.

This is my $customerHostingData as provided by WHMCS default installation

array(5) {
  [0]=>
  array(4) {
    ["id"]=>
    int(1856)
    ["domain"]=>
    string(19) "example.net"
    ["domainstatus"]=>
    string(6) "Active"
    ["packageid"]=>
    int(1)
  }
  [1]=>
  array(4) {
    ["id"]=>
    int(1851)
    ["domain"]=>
    string(17) "example2.net"
    ["domainstatus"]=>
    string(6) "Active"
    ["packageid"]=>
    int(54)
  }
  [2]=>
  array(4) {
    ["id"]=>
    int(1481)
    ["domain"]=>
    string(12) "example3.net"
    ["domainstatus"]=>
    string(6) "Active"
    ["packageid"]=>
    int(54)
  }
  [3]=>
  array(4) {
    ["id"]=>
    int(1320)
    ["domain"]=>
    string(17) "example4.com"
    ["domainstatus"]=>
    string(6) "Active"
    ["packageid"]=>
    int(54)
  }
  [4]=>
  array(4) {
    ["id"]=>
    int(667)
    ["domain"]=>
    string(24) "example5.com"
    ["domainstatus"]=>
    string(6) "Active"
    ["packageid"]=>
    int(54)
  }
}

Now i have implemented a login button on every hosting account on the list to redirect customer to their website dashboard URL

URL: can be http or https://{$site.domain}/dashboard/login

the problem that i'm facing with the code above is that the {$customerHostingData} array do not contain any information about the ssl status on account, to basically i cant check if the ssl is active or not?

So how can i make this type of check to determine which hosting account on the array has active SSL certificate?

Any ideas?
 

Edited by Jomart_123
Link to comment
Share on other sites

Perhaps the code in the modules/reports/ssl_certificate_monitoring and templates/twenty-one/clientareadomaindetails files will help.

In general, you can use

$clientSslStatuses = WHMCS\Domain\Ssl\Status::where("user_id", $userid)->get();
$sslStatus = WHMCS\Domain\Ssl\Status::factory($userid, $domain);

 

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.

×
×
  • 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