Devai Posted January 9 Share Posted January 9 I am curious how do i get client id from session or by from client product is it possible? 0 Quote Link to comment Share on other sites More sharing options...
Slaweally Posted January 14 Share Posted January 14 <?php use WHMCS\Session; use Illuminate\Database\Capsule\Manager as Capsule; add_hook('ClientLogin', 1, function($vars) { $clientId = $vars['userid']; logActivity("Client logged in: $clientId"); }); add_hook('AfterModuleCreate', 1, function($vars) { $clientId = $vars['userid']; $productId = $vars['serviceid']; logActivity("New product created. Client ID: $clientId, Product ID: $productId"); $client = Capsule::table('tblclients')->where('id', $clientId)->first(); if ($client) { logActivity("Client Name: {$client->firstname} {$client->lastname}"); } }); add_hook('ClientAreaPage', 1, function($vars) { $clientId = Session::get('uid'); if ($clientId) { logActivity("Page loaded. Session Client ID: $clientId"); } else { logActivity("Page loaded. No client logged in."); } }); ?> ?> Yes, you can do this by using a hook, but what you will do afterwards is also important. I shared a sample hook above, you can improve it according to yourself. 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.