Showing captcha in search

Discussion in 'Off-Topic' started by ex-vber, Feb 11, 2012.

  1. ex-vber New Member

    This is a must have hack for me as I have very big and busy forums and bots using the search has caused me a lot of down time. If I get this I will be moving to xenforo immediately. I am hopeing that I am not bothering you with my questions but this is the last one.

    At the Search.php file in the publiccontroller folder we enter this code

    Code:
    $viewParams = array(
    
    			'captcha' => XenForo_Captcha_Abstract::createDefault()
    			)
    		);
    Then we do this

    Code:
    if (!XenForo_Captcha_Abstract::validateDefault($this->_input))
    		{
    		     return $this->responseCaptchaFailed();
    		}
    And we add the captcha codes at the search template. We get half of the work done. The users will get teh captcha failed message but the captcha is not shown. How can we make the captcha shown?

    Please help me as this is the last modification holding me back to switch to xenforo.

    Have a great week end everyone.

    Or if you can make a hack package for us that shows the captcha at the search it would be much appreciated. I will make a handsome donation for your time and I will be purchasing the 2 hacks from you and convert to xenforo. Thank you and I am sorry if I am bothring you with my questions but I want to get away from vb as soon as possible.
  2. Robbo Staff Member

    Could I see your template additions?

    If I can't figure out the issue I will make an add-on for you when I get a bit of spare time.
  3. ex-vber New Member

    Thank you Robbo.

    We enter the captcha templates in several variations but it is not woking.

    Code:
    <div>{xen:raw $captcha}</div>

    Code:
    <div id="ReCaptcha" data-publicKey="{$publicKey}" style="display:none">
    	<div id="recaptcha_image" class="textCtrl"></div>
    	<div class="ddText"><label for="recaptcha_response_field">{xen:phrase recaptcha_enter_both_words}:</label></div>
    	<input type="text" name="recaptcha_response_field" id="recaptcha_response_field" class="textCtrl OptOut" />
    	<p class="explain recaptcha_only_if_image">{xen:phrase recaptcha_reload_listen_to_audio, 'reload_params=href="javascript:" class="ReCaptchaReload"', 'switch_params=href="javascript:" class="ReCaptchaSwitch"'}</p>
    	<p class="explain recaptcha_only_if_audio">{xen:phrase recaptcha_reload_go_back_to_text, 'reload_params=href="javascript:" class="ReCaptchaReload"', 'switch_params=href="javascript:" class="ReCaptchaSwitch"'}</p>
    </div>
    <div id="ReCaptchaLoading" class="JsOnly">{xen:phrase recaptcha_verification_is_loading}</div>
    
    <noscript>
    	<iframe src="//www.google.com/recaptcha/api/noscript?k={xen:urlencode $publicKey}" height="300" width="500" frameborder="0"></iframe><br />
    	<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
    	<input type="hidden" name="recaptcha_response_field" value="manual_challenge" />
    </noscript>

    Code:
    <xen:if is="{$captcha}">
    	<dl class="ctrlUnit">
    		<dt>{xen:phrase verification}:</dt>
    		<dd>{xen:raw $captcha}</dd>
    	</dl>
    </xen:if>

    Code:
    <xen:include template="helper_captcha_unit" />

    None of the above is showing the captcha. I would be very grateful if you can make a quick mod that does that. Because we want to move from vbulletin asap.
  4. Robbo Staff Member

    I think you need to extend controller and/or view to add the $search variable for the template. Look at the register controller and views to try figure it out.
    ex-vber likes this.
  5. ex-vber New Member

    We have tried that too but no luck Robbo. This oop system is a little complicated.

    If we try to make it like a mod, what code should we place at the Controller file and what code at the listner? Can you please give us a little push in the right direction?
  6. Robbo Staff Member

    It's hard to know without looking into it. I think you need to extend the controller, call the parent action and then add the view param for the captcha. I'll probably have to end up doing this for you when I get a chance.
    ex-vber likes this.
  7. ex-vber New Member

    That would be great, thank you very much. My coder guy knows a little php but from what he told me xenforo is using another system, oop than what is is used at vb. This is the only thing holding me back to convert my forums.

Share This Page