J-B Posted May 23, 2022 Share Posted May 23, 2022 Hello, i want to get the countrycode of the user in the viewinvoice. If the user is from "DE" then do something. <?php function viewinvoice_loggedin_status_hook($vars) { $countrycode = $params['clientsdetails']['country']; if ($countrycode == 'DE') { .... } add_hook("ClientAreaPageViewInvoice", 1, "viewinvoice_loggedin_status_hook"); Anyone an idea what's wrong? 0 Quote Link to comment Share on other sites More sharing options...
J-B Posted May 24, 2022 Author Share Posted May 24, 2022 @brian! do you have a idea or solution? 0 Quote Link to comment Share on other sites More sharing options...
bear Posted May 24, 2022 Share Posted May 24, 2022 Brian! essentially retired from this board a while back. Though he did say he'd (very) occasionally drop in, it's unlikely a good plan to wait for him. Sorry. 0 Quote Link to comment Share on other sites More sharing options...
J-B Posted May 24, 2022 Author Share Posted May 24, 2022 Bad! This was the most helpful member on the community. 0 Quote Link to comment Share on other sites More sharing options...
bear Posted May 24, 2022 Share Posted May 24, 2022 Many would agree, myself included. Extremely helpful and knew a thing or two. 😉 Several here on par with him for the most part, but not always around, again, mostly due to the reprehensible licensing changes 'round here (I'm guessing). 1 Quote Link to comment Share on other sites More sharing options...
DennisHermannsen Posted May 25, 2022 Share Posted May 25, 2022 Since the variable name passed to the function is $vars, you won't be able to get any details with $params. This code will work: <?php add_hook('ClientAreaPageViewInvoice', 1, function($vars) { if($vars['client']['country'] === 'DE'){ // do stuff } }); 0 Quote Link to comment Share on other sites More sharing options...
J-B Posted May 25, 2022 Author Share Posted May 25, 2022 @DennisHermannsen many thanks from you! It works. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 29, 2022 Share Posted May 29, 2022 On 24/05/2022 at 11:34, J-B said: do you have a idea or solution? I don't get email notifications any more for posts and/or mentions (I disabled them last year) - so mentioning me in a thread, in the hope that I will see it, is really not worth doing. On 24/05/2022 at 11:39, bear said: Brian! essentially retired from this board a while back. Though he did say he'd (very) occasionally drop in, it's unlikely a good plan to wait for him. Sorry. here I am... hello everyone! I hope everyone is doing well - i've literally no idea what has been posted in this place over the last year... I enjoy living my life in ignorance of this place for the most part! 😎 On 24/05/2022 at 19:57, bear said: Many would agree, myself included. Extremely helpful and knew a thing or two. 😉 yes - I knew two things... one of them i've sadly now forgotten and the second i've carelessly misplaced. 😜 On 24/05/2022 at 19:57, bear said: Several here on par with him for the most part, but not always around, again, mostly due to the reprehensible licensing changes 'round here (I'm guessing). others will be your best bet now... my time visiting this place on a regular basis ended last year and my knowledge is fading... and as much as I could get back into the habit of coming here, I won't as there are much more enjoyable things to do. 🏝️ all that said, many months ago I did get asked to code an action hook that completely rewrites the v8 admin menu into something more sensibly organised and useful.... works on v8.3 and as there were no admin changes, I assume it works on v8.4... and seeing no specific admin changes in the changelogs (though experience tells you that might not necessarily mean that there aren't any lol), it should probably work in v8.5.... screenshot below is a little overkill as all display options are enabled (which you wouldn't really do normally), but topbar / stats bar / menus can all be individually enabled or their content changed... the damn thing has over 1k+ lines of code, but should continue to work regardless of using WHMCS. the irony is that having written it, I no longer personally have any need to run v8 as I don't use it myself and am not actively answering questions in this place anymore. 🙄 perhaps when v8.5 goes GA (or I suppose if things haven't changed at WHMCS, I should probably wait for the first v8.5.1 maintenance release lol) and if the inclination hits me, i'll test it again and perhaps post it on GitHub. thanks to @DennisHermannsen for posting a solution. 2 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.