Thursday, May 17, 2012

Replace PhocaGuestbook captcha with JoomlaEZ's reCaptcha Integrator plugin

 I thought I'd add this as I'm weary on low level captcha plugins and like replacing it with reCaptcha...

First of all, disable the built-in captcha for PhocaGuestbook:

  1. Components > Phoca Guestbook
  2. Select "Items" and click on the "Parameters" icon in the top right
  3. Scroll down to "Enable Captcha" and set this to "NO"

Time for some hard-coding:

At about line 287 in the file /components/com_phocaguestbook/views/phocaguestbook/tmpl/default.php you should find the following code:

 
	<tr>
		<td> </td>
		<td colspan="3"><input type="submit" name="save" value="<?php echo JText::_('Submit'); ?>" />  <input type="reset" name="reset" value="<?php echo JText::_('Reset'); ?>" /></td>
	</tr>
</table>

Replace this with:

 
	<tr>
		<td> </td>
		<td colspan="3">
		<?php
			global $mainframe;
			$mainframe->triggerEvent('onCaptchaDisplay');
		?>
		</td>
	</tr>
	<tr>
		<td> </td>
		<td colspan="3"><input type="submit" name="save" value="<?php echo JText::_('Submit'); ?>" />  <input type="reset" name="reset" value="<?php echo JText::_('Reset'); ?>" /></td>
	</tr>
</table>

HEY! It's not over yet.

I found that this change causes a silent JavaScript error (as in some browsers will just process the form normally but this needs to be fixed anyway). At about line 11:

 
var text = tinyMCE.getContent();

Comment this out and insert or replace with:

 
var text = form.pgbcontent.value;

Works for me...

Add comment

Please note: all comments are reviewed before being published.


Security code
Refresh

Member Login

Joes Latest Members

A huge WELCOME goes to today's newest members:

  • infonat
Member Signups (Activated)
BeforeCurrentTrend
Day21=
Week105ê
Month11224ê
Year2,265612ê

Member Stats
58 guests are currently online.
1,178 members are still deciding.
There are 5,935 members in total.

Latest Comments

Paypal Donations

Want to support my work? Any donation is a blessing :c)