I'm posting this as a reference, and also to give you a hint on how to use CB plugins from other CB plugins, or joomla/mambo modules, components or mambots:
Check the code of mod_cblogin.php of CB 1.1 and also of CB captcha 2.0, you will see that using any CB-compatible captcha engine, including CB captcha v2.0 (not v1.0) from another CB plugin is matter of a few lines of code (basically, generating the CB-event to get the captcha html code, and another event to check):
We have defined new events in CB 1.1 which are not yet official, since they are experimental, so not sure that the next major release of CB will support this, but hey, it's a few lines of code...:
Something like this should work (not tested):
within your <form> :
[code:1]
<?php
if ( $cb_plugins_captcha ) {
include_once( $absolute_path . "/administrator/components/com_comprofiler/plugin.class.php"«»);
global $_PLUGINS;
$generateFullHtml = true;
$_PLUGINS->loadPluginGroup('user');
$pluginsResults = $_PLUGINS->trigger( 'onGetCaptchaHtmlElements', array( generateFullHtml ) );
if ( implode( $pluginsResults ) != '' ) {
$divHtml = '<div class="your_formatting">' ;
echo $divHtml . implode( '</div>' . $divHtml, $pluginsResults ) . '</div>';
}
}
[/code:1]
To check the captcha posted:
[code:1]
<?php
if ( $cb_plugins_captcha ) {
include_once( $absolute_path . "/administrator/components/com_comprofiler/plugin.class.php"«»);
global $_PLUGINS;
$_PLUGINS->loadPluginGroup('user');
$pluginsResults = $_PLUGINS->trigger( 'onCheckCaptchaHtmlElements', array( ) );
$passed = true;
foreach( $pluginsResults as $thisResult ) {
if ( ! $thisResult ) {
$passed = false;
}
}
if ( ! $passed ) {
// do here whatever you need to do when check isn't passed.
}
}
[/code:1]
in the code above, this line:
[code:1] include_once( $absolute_path . "/administrator/components/com_comprofiler/plugin.class.php"«»);
[/code:1]
is needed in joomla/mambo modules and other components, but not in other CB plugins.
Advantages:
1) not a hack
2) This should allow you to insert accessible captcha anywhere: CB plugins, any module, any component.
3) using clean CB API methods.
I need to issue a warning here: don't put captcha everywhere: it's a pain for users, and it will not stop determined spammers. Your site processes and business model should really be the human-test factor.
Hope the code above works, as i didn't test it. Please give feedbacks here, and continue share your progress and implementations with the community here.