honesting Posted May 28, 2018 Share Posted May 28, 2018 As the contact form doesn't ask for permission before one visitor can send it, the form and WHMCS is illegal to use it at Europe. So I've created a request to fix that. Please vote it at: https://requests.whmcs.com/topic/adapt-gdpr-to-european-laws 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 28, 2018 Share Posted May 28, 2018 31 minutes ago, honesting said: As the contact form doesn't ask for permission before one visitor can send it, the form and WHMCS is illegal to use it at Europe. then wouldn't it be quicker to edit contact.tpl, add a required checkbox form field and solve the problem that way... 1 Quote Link to comment Share on other sites More sharing options...
twhiting9275 Posted May 28, 2018 Share Posted May 28, 2018 Yeah, the template is the quick and dirty approach, but it should be fixed a bit better, at the core itself. Just sayin 0 Quote Link to comment Share on other sites More sharing options...
wp4all Posted May 28, 2018 Share Posted May 28, 2018 Hi, does anyone know if there is a hook index for contact.php? https://developers.whmcs.com/hooks/hook-index/ can't find something there. Greetings Christian 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 29, 2018 Share Posted May 29, 2018 19 hours ago, twhiting9275 said: Yeah, the template is the quick and dirty approach, but it should be fixed a bit better, at the core itself. Just sayin I wouldn't argue with that - yes, if it's illegal, WHMCS absolutely need to do something about it - submitting a feature request is probably the "official and proper" way to do it, but we all know the efficiency and time required for a feature to be completed... though admittedly this is slightly different because GDPR compliance is a work in progress (for everyone!), so I would fully expect WHMCS to address this with a future update (assuming they agree with the legality issue)... I was merely suggesting that editing the template would be a quick "band-aid" whilst waiting for WHMCS to give a "proper" fix - whether that be a hook, or in the v7.5.2 update... in the time taken to submit the feature request, I could have typed the two lines of HTML required! 19 hours ago, wp4all said: does anyone know if there is a hook index for contact.php? ClientAreaPageContact would be one... but if you really want to add a required checkbox to the contact page, without dirtying your hands editing the template, you could tweak the hook code posted by @WHMCS John in the Second Terms thread. <?php add_hook('ClientAreaFooterOutput', 1, function ($vars) { if ($vars['filename'] != 'contact') { return false; } $output = '<div class="text-center"> <label class="checkbox-inline"> <input type="checkbox" name="additional_agreement" value="1" required /> I can confirm I have read and agree to the <a href="https://www.example.com/" target="_blank">Demo Agreement</a> </label> </div> <br />'; return '<script> jQuery(\'.btn-primary\').before("' . preg_replace( "/\r|\n/", "", str_replace('"', '\"', $output)) . '"); </script>'; }); because WHMCS have an annoying tendency not to add proper IDs to many of their templates (especially the older ones - and contact.tpl is virtually prehistoric!), in order to make this work, i've had to use the button class instead of an ID... you could edit the template, give the button field an ID and use that in the hook, but it seems a little redundant to edit a template just to make the hook work - if you're going to do that, you might as well just edit the template! WHMCS really should have added proper IDs to all the templates by now... I can remember answering a question 2-3 years ago, and the solution to that was hampered by the template not having any IDs... and here we are, halfway through 2018, still hitting the same brick wall. so because the checkbox is required, the user cannot submit without ticking the box - if necessary, that error message, and the "I can confirm" line, are all translatable into the current WHMCS language - you'd just need to create the Language Overrides and modify the hook to use them. 1 Quote Link to comment Share on other sites More sharing options...
wp4all Posted June 4, 2018 Share Posted June 4, 2018 Hi Brian, any way to get this hook multilingual ready ? Greetings Christian 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted June 4, 2018 Share Posted June 4, 2018 Hi Christian, 53 minutes ago, wp4all said: any way to get this hook multilingual ready ? it should be as simple as doing this... <?php /** * Contact Form Agreement Required Checkbox Field * @author brian! */ add_hook('ClientAreaFooterOutput', 1, function ($vars) { if ($vars['filename'] != 'contact') { return false; } $output = '<div class="text-center"> <label class="checkbox-inline"> <input type="checkbox" name="additional_agreement" value="1" oninvalid="this.setCustomValidity(\''.Lang::trans('contactformrequired').'\')" required /> '.Lang::trans('contactformagreement').' </label> </div> <br />'; return '<script> jQuery(\'.btn-primary\').before("' . preg_replace( "/\r|\n/", "", str_replace('"', '\"', $output)) . '"); </script>'; }); you'll then need Language Override entries for every language you're using... e.g English and German (forgive Google for the German translations!)... both for the text description and any resulting error message. $_LANG['contactformagreement'] = "I can confirm that I have read, and agree to, the <a href=\"https://www.example.com/\" target=\"_blank\">Agreement</a>."; $_LANG['contactformagreement'] = "Ich kann bestätigen, dass ich die Vereinbarung gelesen habe und ihr <a href=\"https://www.example.com/\" target=\"_blank\">zustimme</a>."; if you try to submit without ticking the box, you'll see an error message in the current language... $_LANG['contactformrequired'] = "Please tick this box if you want to proceed."; $_LANG['contactformrequired'] = "Bitte kreuzen Sie dieses Kästchen an, wenn Sie fortfahren möchten."; 1 Quote Link to comment Share on other sites More sharing options...
wp4all Posted June 4, 2018 Share Posted June 4, 2018 Hi Brian, sometimes to simple didn't got the "contactformrequired" translated . Thanks Brian 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.