PlayThru and K2 Login

More
11 Sep 2012 16:04 #151 by Senecca
Hello,

thanks a lot for the effort you've put in the joomla plugin of PlayThru.

Is it somehow possible to use PlayThru Captcha in K2 Login Form? Usually its recaptcha but i dont know how to change it to PlayThru.

Please Log in to join the conversation.

More
11 Sep 2012 16:46 #152 by admin
Replied by admin on topic PlayThru and K2 Login
mhm...

i think it's up to K2.
Playthru is a captcha plugin, so as long as you set it as the default captcha for your site, any component that uses the global configuration should display it.

Please Log in to join the conversation.

More
07 Feb 2013 16:51 - 07 Feb 2013 16:54 #618 by felfert
Replied by felfert on topic PlayThru and K2 Login
Actually, it's not so difficult. If you happen to use a custom template, you can do it in a template override. Here is a short description (for K2's registration form, tested in Joomla 2.5.9):

Step 1:
In your custom template folder, create a sub-folder hierarchy named html/com_k2. E.g. If your curstom template is in templates/bos/, then the new folders path is templates/bos/html/com_k2

Step 2:
Copy K2's original registration form from components/com_k2/templates/register.php to the previously created folder. E.g: in the example above, that would be templates/bos/html/com_k2/register.php

Step 3:
Edit the copied file and find the single line that contains the closing table tag:
</table>

Step 4: Insert the following code snippet above that line:
<?php
                if (!($this->K2Params->get('recaptchaOnRegistration') && $this->K2Params->get('recaptcha_public_key'))) {
                    $configured_captcha = JFactory::getApplication()->getParams()->get('captcha', JFactory::getConfig()->get('captcha'));
                    if (!empty($configured_captcha)) {
                        $jcaptcha = JCaptcha::getInstance($configured_captcha, array('namespace' => 'com_users.registration'));
                        if (!is_null($jcaptcha)) {
                            JRequest::setVar('session_secret', uniqid()); // Required by playthru captcha plugin
                            $ccode = $jcaptcha->display("jcaptcha", "jcaptcha", "required");
                            echo '<tr>' . "\n";
                            echo '<td class="key">' . JText::_('TPL_BOS_PLAYTHRU_CAPTCHA_LABEL') . "</td>\n";
                            echo "<td>" . $ccode . "</td>\n";
                            echo "<td> * </td>\n";
                            echo '</tr>' . "\n";
                        }
                    }
                }
            ?>

Remarks:
In the code snippet above, there's a translation key TPL_BOS_PLAYTHRU_CAPTCHA_LABEL which represents the descriptive text left of the playthru captcha. In order to show desired text, you must create a file named language/overrides/en-GB.override.ini and put the following line into it:

TPL_BOS_PLAYTHRU_CAPTCHA_LABEL="Whatever text you like"


The code snippet is not specific to the playthru capcha. In fact, it simply uses whatever captcha plugin is configured globally in the backend.

In order to enable it, you have to disable K2's recaptcha option in the backend.

Hope this helps...
-Fritz
Last edit: 07 Feb 2013 16:54 by felfert. Reason: added joomla version

Please Log in to join the conversation.

More
08 Feb 2013 12:05 #623 by admin
Replied by admin on topic PlayThru and K2 Login
thank you very much for this snippet!
I'll set it to sticky so other users will see it.

Please Log in to join the conversation.

Time to create page: 0.249 seconds