Skip to main content

Posts

Showing posts from July, 2017

Cakephp 3x- Add Email verification on registration

How to add email verification on registration Cakephp 3.x In this tutorial we will add email verification on user register so whenever a new user registered in our site then he will receive an email with confirmation link and after confirmation link click , his account will activate. this tutorial is also for that users that want to learn how to setup email configration in cakephp 3.x. for basic knowledge you can check this post Send mail using mail class in cakephp 3 SO FOLLOW THESE SIMPLE STEPS TO VERIFY USER EMAIL ON REGISTRATION First we need to add one table with three columns id email and status . you can run below query to create a table CREATE TABLE `cake`.`users` ( `id` INT NOT NULL AUTO_INCREMENT , `email` VARCHAR(50) NOT NULL , `otp` VARCHAR(50) NOT NULL , `status` INT NOT NULL DEFAULT '0' , PRIMARY KEY (`id`)) ENGINE = InnoDB; Your database table should look like In this tutorial we will use gmail for smtp so first we need to configure EmailTra

Cakephp 3x Add TinyMCE text editor in 2 Steps

Cakephp 3.x Add text editor in 2 Steps In this tutorial we will use TinyMCE because its easy to implement TinyMCE text editor Step 1 So First Add this js to your header or default layout or your preferred location where you call other js files <script src="//cdn.tinymce.com/4/tinymce.min.js"></script>   <script> tinymce.init({ selector:'.edittextarea', height: 500,  plugins: [     'advlist autolink lists link print preview anchor',     'visualblocks code fullscreen',     'insertdatetime table contextmenu paste code'   ], }); </script>   Step 2 Now Add edittextarea class to textarea where you want to change textarea to text editor Here is the example of how to create text editor textarea in Cakephp 3.x  <?= $this->Form->input('description', array('type' => 'textarea','class' => 'edittextarea form-control','value'=>$description,

Cakephp-3x-On debug Mode for controller or action

Cakephp 3.x On debug Mode for a specific controller or action To on debug mode for only one controller or action you should follow below steps:- First call configure into your controller at the top(check its already called then don't call it again) use Cake\Core\Configure; Then in your controller action paste this line or if you want it to on for all actions of a controller then paste this line into beforeFilter or initialize Configure::write('debug', 2);    Now run your controller action and your debug mode will be on for specific controller and action. On Debug mode only for specific IP Address If you want to on debug only for you or any specific IP Address then first get your ip address you can get ip address in cakephp using this code. use Cake\Network\Request; echo $this->request->clientIp(); OR with php $_SERVER['REMOTE_ADDR']; then you can use below code         $clientIpAddress = $this->request->clientIp();