Jump to content

Version 7 remove captcha on domain checker


graisbeck

Recommended Posts

Hi, I know this has been asked more than once in the past, but has anyone found the solution for removing the irritating captcha within the index.php and cart.php?a=add&domain=register pages only without having to disable it in Setup>General settings>Security?

I have searched through the internet and cannot find the answer as all relate to removing part of the script from domainchecker.tpl which is no longer in use in version 7.

 

Any help would be appreciated.

 

Regards,

Gary

Link to comment
Share on other sites

Hi Gary,

 

Is there a way to remove the captcha from the cart.php page which follows after checking a domain?

for the cart, I don't think that there's any need to edit any templates to do this with v7 - you could use an action hook...

 

so create a .php file in /includes/hooks/, call it captcha.php (or anything you like) and add the code below into it...

 

<?php

# Disable Captcha
# Written by brian!

function hook_disable_captcha($vars) {

   return array("captcha" => "");   
}

add_hook("ClientAreaPageCart",1,"hook_disable_captcha"); 
add_hook("ClientAreaPageHome",1,"hook_disable_captcha"); 
?>

this code uses two hooks - one for the cart, one for the homepage - if you don't want to use both, just remove the line for the one you don't need. :idea:

 

weirdly, without captcha being active, when you enter a search term in the homepage domain lookup, it doesn't initiate a search in the cart... regardless of whether you use the hook or simply remove the captcha line of code. :roll:

one way to get around that would be to modify header.tpl and change...

 

                <form method="post" action="domainchecker.php">
                   <div class="row">
                       <div class="col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1">
                           <div class="input-group input-group-lg">
                               <input type="text" class="form-control" name="domain" placeholder="{$LANG.exampledomain}" autocapitalize="none" />
                               <span class="input-group-btn">
                                   {if $registerdomainenabled}
                                       <input type="submit" class="btn btn-warning" value="{$LANG.search}" />
                                   {/if}
                                   {if $transferdomainenabled}
                                       <input type="submit" name="transfer" class="btn btn-info" value="{$LANG.domainstransfer}" />
                                   {/if}
                               </span>
                           </div>
                       </div>
                   </div>
                   {include file="$template/includes/captcha.tpl"}
               </form>
           {else}
               <h2>{$LANG.doToday}</h2>
           {/if}

to...

 

            {if $registerdomainenabled || $transferdomainenabled}
               <h2>{$LANG.homebegin}</h2>
               <form method="post" action="cart.php?a=add&domain=register">
                   <div class="row">
                       <div class="col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1">
                           <div class="input-group input-group-lg">
                               <input type="text" class="form-control" name="query" placeholder="{$LANG.exampledomain}" autocapitalize="none" />
                               <span class="input-group-btn">
                                   {if $registerdomainenabled}
                                       <input type="submit" class="btn btn-warning" value="{$LANG.search}" />
                                   {/if}
                                   {if $transferdomainenabled}
                                       <input type="submit" name="transfer" class="btn btn-info" value="{$LANG.domainstransfer}" />
                                   {/if}
                               </span>
                           </div>
                       </div>
                   </div>

                   {include file="$template/includes/captcha.tpl"}
               </form>
           {else}
               <h2>{$LANG.doToday}</h2>
           {/if}

all i've done is to send the term to the cart directly and not to the domainchecker redirect file, and change a field name from "domain" to "query" (which is what the cart is expecting to receive)... I assume domainchecker.php will be removed with v7.2 anyway.

 

although I suppose if you're going to edit the header.tpl template file to make these changes, you might as well just remove the {include} line and forget about the hook for the homepage! :)

Link to comment
Share on other sites

  • 5 months later...
  • 4 months later...
  • 1 month later...
On 3/31/2017 at 9:31 PM, brian! said:

Hi Gary,

 

for the cart, I don't think that there's any need to edit any templates to do this with v7 - you could use an action hook...

 

so create a .php file in /includes/hooks/, call it captcha.php (or anything you like) and add the code below into it...

 

 


<?php

# Disable Captcha
# Written by brian!

function hook_disable_captcha($vars) {

   return array("captcha" => "");   
}

add_hook("ClientAreaPageCart",1,"hook_disable_captcha"); 
add_hook("ClientAreaPageHome",1,"hook_disable_captcha"); 
?>
 

 

this code uses two hooks - one for the cart, one for the homepage - if you don't want to use both, just remove the line for the one you don't need. :idea:

 

weirdly, without captcha being active, when you enter a search term in the homepage domain lookup, it doesn't initiate a search in the cart... regardless of whether you use the hook or simply remove the captcha line of code. :roll:

one way to get around that would be to modify header.tpl and change...

 

 


                <form method="post" action="domainchecker.php">
                   <div class="row">
                       <div class="col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1">
                           <div class="input-group input-group-lg">
                               <input type="text" class="form-control" name="domain" placeholder="{$LANG.exampledomain}" autocapitalize="none" />
                               <span class="input-group-btn">
                                   {if $registerdomainenabled}
                                       <input type="submit" class="btn btn-warning" value="{$LANG.search}" />
                                   {/if}
                                   {if $transferdomainenabled}
                                       <input type="submit" name="transfer" class="btn btn-info" value="{$LANG.domainstransfer}" />
                                   {/if}
                               </span>
                           </div>
                       </div>
                   </div>
                   {include file="$template/includes/captcha.tpl"}
               </form>
           {else}
               <h2>{$LANG.doToday}</h2>
           {/if}
 

 

to...

 

 


            {if $registerdomainenabled || $transferdomainenabled}
               <h2>{$LANG.homebegin}</h2>
               <form method="post" action="cart.php?a=add&domain=register">
                   <div class="row">
                       <div class="col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1">
                           <div class="input-group input-group-lg">
                               <input type="text" class="form-control" name="query" placeholder="{$LANG.exampledomain}" autocapitalize="none" />
                               <span class="input-group-btn">
                                   {if $registerdomainenabled}
                                       <input type="submit" class="btn btn-warning" value="{$LANG.search}" />
                                   {/if}
                                   {if $transferdomainenabled}
                                       <input type="submit" name="transfer" class="btn btn-info" value="{$LANG.domainstransfer}" />
                                   {/if}
                               </span>
                           </div>
                       </div>
                   </div>

                   {include file="$template/includes/captcha.tpl"}
               </form>
           {else}
               <h2>{$LANG.doToday}</h2>
           {/if}
 

 

all i've done is to send the term to the cart directly and not to the domainchecker redirect file, and change a field name from "domain" to "query" (which is what the cart is expecting to receive)... I assume domainchecker.php will be removed with v7.2 anyway.

 

although I suppose if you're going to edit the header.tpl template file to make these changes, you might as well just remove the {include} line and forget about the hook for the homepage! :)

I tried doing this to my custom template search initiated when i click search but when i click transfer it initiated search instead

Link to comment
Share on other sites

18 hours ago, cyben76 said:

I tried doing this to my custom template search initiated when i click search but when i click transfer it initiated search instead

well you have to bear in mind the thread is a year old and used the default templates.... once you get into the realms of custom templates, then all bets are off.

are you just trying the hook ?

Link to comment
Share on other sites

6 hours ago, brian! said:

well you have to bear in mind the thread is a year old and used the default templates.... once you get into the realms of custom templates, then all bets are off.

are you just trying the hook ?

Nope, not the hook method... Just the "sending to cart" directly method.. Works great if i click on register domain, but when i click transfer it initiated search in the cart instead of the domain transfer page

Link to comment
Share on other sites

19 hours ago, cyben76 said:

Nope, not the hook method... Just the "sending to cart" directly method.. Works great if i click on register domain, but when i click transfer it initiated search in the cart instead of the domain transfer page

if I go to your site, type google.com into the domain search box on the WordPress home page and click "Transfer", i'm forwarded to cart.php?a=add&domain=transfer&query=google.com

now if all you want to do is remove captcha from that transfer page, then just use the hook, no template changes should be needed. :idea:

Link to comment
Share on other sites

2 hours ago, brian! said:

if I go to your site, type google.com into the domain search box on the WordPress home page and click "Transfer", i'm forwarded to cart.php?a=add&domain=transfer&query=google.com

now if all you want to do is remove captcha from that transfer page, then just use the hook, no template changes should be needed. :idea:

WordPress? Actually captcha on the transfer page is ok with me.. Removing the captcha on domain search, i just remove the captcha div.. 

The problem, if i use 

<form method="post" action="domainchecker.php">

It does not initiate the check, users need to click search a second time.

But if i use

 <form method="post" action="cart.php?a=add&domain=register">

and

<input type="text" class="form-control" name="query" placeholder="{$LANG.exampledomain}" autocapitalize="none" />

It initiates search...:idea: But when users click transfer, it stills goes to search instead of transfer:(

 

Link to comment
Share on other sites

17 minutes ago, cyben76 said:

WordPress?

my mistake, forget it's a custom template.

17 minutes ago, cyben76 said:

But when users click transfer, it stills goes to search instead of transfer

because you're specifying "register" in the URL.

go back to using domainchecker.php, but disable the modalpleasewait stuff and see if that solves the issue... this looks like an issue with the custom rather than WHMCS, cos when I try it on the six homepage, it works fine.

Link to comment
Share on other sites

On 3/6/2018 at 3:03 AM, brian! said:

my mistake, forget it's a custom template.

because you're specifying "register" in the URL.

go back to using domainchecker.php, but disable the modalpleasewait stuff and see if that solves the issue... this looks like an issue with the custom rather than WHMCS, cos when I try it on the six homepage, it works fine.

So I managed to work around the problem...

Taking your initial solution:
 

<form method="post" action="cart.php?a=add&domain=register">
                   <div class="row">
                       <div class="col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1">
                           <div class="input-group input-group-lg">
                               <input type="text" class="form-control" name="query" placeholder="{$LANG.exampledomain}" autocapitalize="none" />
                               <span class="input-group-btn">
                                   {if $registerdomainenabled}
                                       <input type="submit" class="btn btn-warning" value="{$LANG.search}" />
                                   {/if}
                                   {if $transferdomainenabled}
                                       <input type="submit" name="transfer" class="btn btn-info" value="{$LANG.domainstransfer}" />
                                   {/if}

I changed it a little:

 

<form method="post" action="cart.php?a=add&domain=register">
                   <div class="row">
                       <div class="col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1">
                           <div class="input-group input-group-lg">
                               <input id="inputDomain" type="text" class="form-control" name="domain" placeholder="{$LANG.exampledomain}" autocapitalize="none" />
                               <span class="input-group-btn">
                                   {if $registerdomainenabled}
                                       <input type="submit" class="btn btn-warning" value="{$LANG.search}" onclick="DoTransfer();" />
                                   {/if}
                                   {if $transferdomainenabled}
                                       <input type="submit" name="transfer" class="btn btn-info" value="{$LANG.domainstransfer}" onclick="this.form.action='domainchecker.php';" />
                                   {/if}
                                 

At the footer, I added the script:

<script>
function DoTransfer() {
document.getElementById('inputDomain').name = 'query';
};
</script>

 

Link to comment
Share on other sites

2 hours ago, web2008 said:

Does the hook works in version 7.4.2 ?

it does on my v7.4.2 dev.... this is what i'm seeing with captcha enabled in the settings, but disabled by the hook....

both domain searches and transfers are passed correctly... as far as I recall, this is pure hook with no template changes.... the homepage is posting to domainchecker.php, so I know I haven't changed that.

2 hours ago, web2008 said:

When I search for a domain from the frontpage, I must search again on  "cart.php?a=add&domain=register&query=anydomain" because the site don`t show any search results when the hook is active.

you could change the URL in the header form if you had to and pass it to that URL but I don't think it should be necessary..

are you use standard_cart without any modifications ?

Link to comment
Share on other sites

But you don`t get " Congratulations! domain.com is available!" in your example and that's what I think is missing!

When I disable the hook I get this message.

I have a custom order form on my production license, but when I test on 7.5 dev I get the same 

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • 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