WHMCS Peter 18 Posted September 23, 2020 Hi @SwiftModders LLC, You should ideally not use these directly. Instead, use code like the following: <?php use WHMCS\Authentication\CurrentUser; $userId = null; $clientId = null; $ownsClientAccount = false; // User will return the WHMCS\User\User model if the user is logged in. Otherwise, returns null. $user = CurrentUser::user(); // Client will return the WHMCS\User\Client model if a client is selected/in use. Otherwise, returns null. $client = CurrentUser::client(); if ($user) { $userId = $user->id; } if ($client) { $clientId = $client->id } if ($user && $client) { if ($user->isOwner($client)) { $ownsClientAccount = true; } } There should be no need to utilise the session data. Wherever possible, it's best not to interact directly with WHMCS session variables. 0 Quote Share this post Link to post Share on other sites
SwiftModders 10 Posted September 23, 2020 (edited) @WHMCS Peter Thanks, but this is only available in WHMCS 8, correct? This is not available in WHMCS 7.10.2 or earlier. I am trying to find a way to have a single addon that supports both WHMCS 7 and 8. Interacting with the session data is all I have available to me. Edited September 23, 2020 by SwiftModders LLC 0 Quote Share this post Link to post Share on other sites
brian! 3423 Posted September 24, 2020 16 hours ago, SwiftModders LLC said: I am trying to find a way to have a single addon that supports both WHMCS 7 and 8. Interacting with the session data is all I have available to me. would it not be simpler to query the config and find out the version of WHMCS installed - then if it's 7, you do x to get the value you want; and if it's 8, you do y to get the value.... and then once you have the value, you can carry on with your process. 0 Quote Share this post Link to post Share on other sites
SwiftModders 10 Posted September 24, 2020 (edited) 3 minutes ago, brian! said: would it not be simpler to query the config and find out the version of WHMCS installed - then if it's 7, you do x to get the value you want; and if it's 8, you do y to get the value.... and then once you have the value, you can carry on with your process. Yes, I created a WHMCS 8 detector function to adjust the way module handles specific situations. I also checked the classes doc and the User class is accessible in WHMCS 7 as well. So, I can simply just check if 8 and handle logic for users. Edited September 24, 2020 by SwiftModders LLC 0 Quote Share this post Link to post Share on other sites
Kian 404 Posted September 24, 2020 34 minutes ago, SwiftModders LLC said: I can simply just check if >= 8 and handle logic for users *fixed... unless they change it again in v9 0 Quote Share this post Link to post Share on other sites
SwiftModders 10 Posted September 24, 2020 1 minute ago, Kian said: *fixed... unless they change it again in v9 Haha, yes, it's a simple utility function that determines if the current version of WHMCS is higher than 8.0.0. 😉 0 Quote Share this post Link to post Share on other sites