info@ektanjali.com +91 99276-99286

CakePHP 2.x User Management Premium Plugin Version 2.3.x

Plugin Bug Fixes & Migration

Bug Fixes and Improvement Table

From Version To Version Changes Date Links
2.3.3 2.3.4 8-Oct-2015  View
2.3.4 2.3.5 27-Nov-2016  View
2.3.5 2.3.6 29-Dec-2019  View

Plugin Version- 2.3.3 to 2.3.4

Date: 08-Oct-2015

Please keep backup of your code before replacing the files. Either you can replace existing files or do changes in existing code as per new changes.

You can download the old version 2.3.3 and make a difference with your application code using Kdiff3 software http://kdiff3.sourceforge.net/ and record your changes done in plugin files.

1. Open app\Plugin\Usermgmt\Controller\UserContactsController.php

Go to contactUs function
Replace 'recaptcha_response_field' with 'g-recaptcha-response'

2. Open app\Plugin\Usermgmt\Controller\UsersController.php

Go to login function
Replace 'recaptcha_response_field' with 'g-recaptcha-response'

Go to register function
Replace 'recaptcha_response_field' with 'g-recaptcha-response'

Go to forgotPassword function
Replace 'recaptcha_response_field' with 'g-recaptcha-response'

Go to emailVerification function
Replace 'recaptcha_response_field' with 'g-recaptcha-response'

3. Open app\Plugin\Usermgmt\Controller\Component\UserAuthComponent.php

Go to beforeFilter function

replace
if (!in_array($actionUrl, $allControllers)) {
    $errorPage=true;
}
with
if (!in_array(strtolower($actionUrl), array_map('strtolower', $allControllers))) {

    $errorPage=true;
}

4. Open app\Plugin\Usermgmt\Model\LoginToken.php

replace
App::uses('AppModel', 'Model');
with
App::uses('UserMgmtAppModel', 'Usermgmt.Model');

replace
class LoginToken extends AppModel
with
class LoginToken extends UserMgmtAppModel

5. Open app\Plugin\Usermgmt\Model\User.php

Go to recaptchaValidate function and replace function with following code
public function recaptchaValidate() {
    App::import("Vendor", "Usermgmt.recaptcha/src/autoload");
    $recaptcha = new \ReCaptcha\ReCaptcha(PRIVATE_KEY_FROM_RECAPTCHA);
    $value = (isset($_POST['g-recaptcha-response'])) ? $_POST['g-recaptcha-response'] : "";
    if(!empty($value)) {
        $resp = $recaptcha->verify($value);
        if(!$resp->isSuccess()) {
            $errors = $resp->getErrorCodes();
            $this->validationErrors['captcha'][0] = __('Prove you are not a robot');
        }
    } else {
        $this->validationErrors['captcha'][0] = __('Please select I\'m not a robot');
    }
    return true;
}

6. Open app\Plugin\Usermgmt\Model\UserContact.php

Go to recaptchaValidate function and replace function with following code
public function recaptchaValidate() {
    App::import("Vendor", "Usermgmt.recaptcha/src/autoload");
    $recaptcha = new \ReCaptcha\ReCaptcha(PRIVATE_KEY_FROM_RECAPTCHA);
    $value = (isset($_POST['g-recaptcha-response'])) ? $_POST['g-recaptcha-response'] : "";
    if(!empty($value)) {
        $resp = $recaptcha->verify($value);
        if(!$resp->isSuccess()) {
            $errors = $resp->getErrorCodes();
            $this->validationErrors['captcha'][0] = __('Prove you are not a robot');
        }
    } else {
        $this->validationErrors['captcha'][0] = __('Please select I\'m not a robot');
    }
    return true;
}

7. Open app\Plugin\Usermgmt\Model\UserEmail.php

replace
App::uses('AppModel', 'Model');
with
App::uses('UserMgmtAppModel', 'Usermgmt.Model');

replace
class UserEmail extends AppModel
with
class UserEmail extends UserMgmtAppModel

8. Open app\Plugin\Usermgmt\Model\UserEmailRecipient.php

replace
App::uses('AppModel', 'Model');
with
App::uses('UserMgmtAppModel', 'Usermgmt.Model');

replace
class UserEmailRecipient extends AppModel
with
class UserEmailRecipient extends UserMgmtAppModel

9. Open app\Plugin\Usermgmt\Model\UserMgmtAppModel.php

Add following fuction
/**
 * Used to validate not empty
 *
 * @access public
 * @return boolean
 */
public function notEmpty($check) {
    $value = array_values($check);
    $value = $value[0];
    if(method_exists(new Validation(), 'notBlank')) {
        return Validation::notBlank($value);
    } else {
        return Validation::notEmpty($value);
    }
}

10. Replace all files of app\Plugin\Usermgmt\Vendor\recaptcha

11. Open app\Plugin\Usermgmt\View\Elements\contact_us.ctp

remove these lines
$this->Form->unlockField('recaptcha_challenge_field');
$this->Form->unlockField('recaptcha_response_field');

12. Open app\Plugin\Usermgmt\View\Elements\login.ctp

remove these lines
$this->Form->unlockField('recaptcha_challenge_field');
$this->Form->unlockField('recaptcha_response_field');

13. Replace app\Plugin\Usermgmt\View\Elements\paginator.ctp

14. Replace app\Plugin\Usermgmt\View\Elements\search_form.ctp

15. Open app\Plugin\Usermgmt\View\Helper\UserAuthHelper.php

replace
var $helpers = array('Session');
with
var $helpers = array('Session', 'Html', 'Form');

add var $recaptcha_script = false; after var $permissions = array();

Go to showCaptcha function and replace it with following code
public function showCaptcha($error=null) {
    $this->Form->unlockField('g-recaptcha-response');
    if(!$this->recaptcha_script) {
        $this->recaptcha_script = true;
        $this->Html->script('https://www.google.com/recaptcha/api.js', array('inline'=>false));
    }
    $code = '<div class="g-recaptcha" data-sitekey="'.PUBLIC_KEY_FROM_RECAPTCHA.'"></div>';
    $errorMsg = '';
    if(!empty($error)) {
        $errorMsg = "<div class='error-message'>".$error."</div>";
    }
    return $code.$errorMsg;
}

16. Open app\Plugin\Usermgmt\View\Users\email_verification.ctp

remove these lines
$this->Form->unlockField('recaptcha_challenge_field');
$this->Form->unlockField('recaptcha_response_field');

17. Open app\Plugin\Usermgmt\View\Users\forgot_password.ctp

remove these lines
$this->Form->unlockField('recaptcha_challenge_field');
$this->Form->unlockField('recaptcha_response_field');

18. Open app\Plugin\Usermgmt\View\Users\login.ctp

remove these lines
$this->Form->unlockField('recaptcha_challenge_field');
$this->Form->unlockField('recaptcha_response_field');

19. Open app\Plugin\Usermgmt\View\Users\register.ctp

remove these lines
$this->Form->unlockField('recaptcha_challenge_field');
$this->Form->unlockField('recaptcha_response_field');

 

Plugin Version- 2.3.4 to 2.3.5

Date: 27-Nov-2016

Please keep backup of your code before replacing the files. Either you can replace existing files or do changes in existing code as per new changes.

You can download the old version 2.3.4 and make a difference with your application code using Kdiff3 software http://kdiff3.sourceforge.net/ and record your changes done in plugin files.

1. Open app\Plugin\Usermgmt\Controller\Component\UserAuthComponent.php

Go to __useCookieToken function
Replace 'split' with 'explode'

2. Open app\Plugin\Usermgmt\Controller\UsersController.php

Go to deleteCache function

Add following line
$this->UserActivity->query('TRUNCATE TABLE user_activities');
after
$this->UserSetting->updateAll(array('UserSetting.value'=>'UserSetting.value + 1'), array('UserSetting.name'=>'QRDN'));

3. Open app\Plugin\Usermgmt\Model\User.php

Go to authsomeLogin function
Replace 'split' with 'explode'

4. Replace all files of app\Plugin\Usermgmt\Vendor\recaptcha

5. Open app\Plugin\Usermgmt\View\UserEmails\send_confirm.ctp

replace
<?php echo $this->Form->create('UserEmail', array('action'=>'send/confirm', 'onSubmit'=>'return validateForm()')); ?>
with
<?php echo $this->Form->create('UserEmail', array('url'=>array('action'=>'send/confirm'), 'onSubmit'=>'return validateForm()')); ?>

6. Open app\Plugin\Usermgmt\View\UserEmails\send_reply_confirm.ctp

replace
<?php echo $this->Form->create('UserEmail', array('action'=>'sendReply/'.$userContactId.'/confirm', 'onSubmit'=>'return validateForm()')); ?>
with
<?php echo $this->Form->create('UserEmail', array('url'=>array('action'=>'sendReply/'.$userContactId.'/confirm'), 'onSubmit'=>'return validateForm()')); ?>

7. Open app\Plugin\Usermgmt\View\UserEmails\send_to_user_confirm.ctp

replace
<?php echo $this->Form->create('UserEmail', array('action'=>'sendToUser/'.$userId.'/confirm', 'onSubmit'=>'return validateForm()')); ?>
with
<?php echo $this->Form->create('UserEmail', array('url'=>array('action'=>'sendToUser/'.$userId.'/confirm'), 'onSubmit'=>'return validateForm()')); ?>

8. Open app\Plugin\Usermgmt\webroot\js\ajaxValidation.js

replace
var selec = this.settings.element.selector;
with
var selec = '#'+this.settings.element.attr('id');
at 2 places

 

Plugin Version- 2.3.5 to 2.3.6

Date: 29-Dec-2019

Please keep backup of your code before replacing the files. Either you can replace existing files or do changes in existing code as per new changes.

You can download the old version 2.3.5 and make a difference with your application code using Kdiff3 software http://kdiff3.sourceforge.net/ and record your changes done in plugin files.

1. Open app\Plugin\Usermgmt\Controller\Component\UserAuthComponent.php

Go to beforeFilter function

Replace this code with

$allControllers=$this->ControllerList->getControllerWithMethods();
$errorPage=false;
if (!in_array(strtolower($actionUrl), array_map('strtolower', $allControllers))) {
    $errorPage=true;
}

with this code

$methods = $this->ControllerList->getControllerAllMethods($controller);
$errorPage = false;
if(!isset($methods[$action])) {
    $errorPage = true;
}

2. Replace app\Plugin\Usermgmt\Controller\Component\ControllerListComponent.php from 2.3.6 version

3. Open app\Plugin\Usermgmt\Controller\Component\SearchComponent.php

Go to beforeRender function

Replace this code with

default:
    continue;

with this code

default:
    break;

4. Replace app\Plugin\Usermgmt\Controller\Component\UserConnectComponent.php from 2.3.6 version

5. Open app\Plugin\Usermgmt\Controller\UsersController.php

Replace login_facebook, login_twitter, login_gmail, login_yahoo, login_linkedin, login_foursquare functions code from 2.3.6 version

6. Open app\Plugin\Usermgmt\Model\Behavior\SearchingBehavior.php

Go to beforeFind function

Replace this code with

Find case 'text': and replace 'continue' with 'break'
Find case 'select': and replace 'continue' with 'break'

7. Open app\Plugin\Usermgmt\Model\UserEmail.php

Replace this code with

var $belongsTo = array('User'=>array('foreignKey'=>'sent_by'));

with this code

var $belongsTo = array('Usermgmt.User'=>array('foreignKey'=>'sent_by'));

8. Open app\Plugin\Usermgmt\Model\UserEmailRecipient.php

Replace this code with

var $belongsTo = array('User');

with this code

var $belongsTo = array('Usermgmt.User');

9. Replace all files of app\Plugin\Usermgmt\Vendor from 2.3.6 version

10. Replace app\Plugin\Usermgmt\View\Elements\message.ctpfrom 2.3.6 version

11. Open app\Plugin\Usermgmt\View\Elements\pagination.ctp

Replace this code with

echo $this->Paginator->numbers(array('separator'=>'', 'tag' => 'li', 'currentTag'=>'span'));

with this code

echo $this->Paginator->numbers(array('separator'=>'', 'tag' => 'li', 'currentTag'=>'span', 'currentClass'=>'active'));

12. Open app\Plugin\Usermgmt\webroot\js\umscript.js

Replace this code with

$('.messageHolder').remove();

with this code

$(this).closest('.messageHolder').remove();