Jump to content

Contact form of WHMCS is illegal at Europe


honesting

Recommended Posts

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... :?:

Link to comment
Share on other sites

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 />
            &nbsp;
            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! :lol:

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. :wall1:

3KRTBMl.png

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. :idea:

Link to comment
Share on other sites

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>.";

4s7x1DZ.png

if you try to submit without ticking the box, you'll see an error message in the current language...

fn1rcHh.png

$_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.";

 

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • 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