info@ektanjali.com +91 99276-99286

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

Miscellaneous

1. Plugin Routing
All URLS related to this plugin are routed from routes.php yourapp/app/Plugin/Usermgmt/Config/routes.php
Basically in CakePHP 2.x version plugin's URL are lengthy. If you want to call plugin's controller's function then you have to use URL
http://umpremium.ektanjali.com/usermgmt/users/index/
So I have shorten the long URLS by CakePHP routing feature. For more clarification see plugin's routes.php

2. Get all controller names and their function names
If you want all controller's names and their finction names any where for that we have a component.

How to use this component
Include ControllerList component in controller's Component variable for e.g.
public $components = array('Usermgmt.ControllerList');
a. If you want all controller's names add their finction names you should call
$result = $this->ControllerList->get();
b. If you want all controller's names you should call
$result = $this->ControllerList->getControllers();
3. User's Dashboard
For now plugin's dashboad contains links only. You can customize this according your need. Location is yourapp/app/Plugin/Usermgmt/View/Users/dashboard.ctp

4. Dashboard Menu
Plugin has dashboard menu system it contains all links. This can be added on any page by calling dashboard element. Location is yourapp/app/Plugin/Usermgmt/View/Users/dashboard.ctp
<?php echo $this->element('Usermgmt.dashboard'); ?>
5. User Auth Helper
As we cannot access component's functions in View file so I have re-declared some functions of User Auth Component in User Auth Helper. for e.g. If you want logged in user id then you can get by following syntax in any controller as well as in any view.
$userId = $this->UserAuth->getUserId();
For more information see
yourapp/app/Plugin/Usermgmt/View/Helper/UserAuthHelper.php and
yourapp/app/Plugin/Usermgmt/Controller/Component/UserAuthComponent.php

6. $var variable for View
This variable is set from beforeRender function of User Auth Component yourapp/app/Plugin/Usermgmt/Controller/Component/UserAuthComponent.php
This contains logged in user's current information.
for e.g. if you want to print logged in user's name then you should use following syntax.
<?php echo h($var['User']['first_name']).' '.h($var['User']['last_name']); ?>
For more information you can use pr($var); for what information this variable have.

7. Ajax login redirect
When user session is timed out and he is trying any operation on site having ajax request then user will be redirect on login page on ajax request as well.

8. Slug in URL(username after domain name)
You can use username after domain name in URL like facebook click here. For this plugin click here. If you want to customize this you can change in SlugRoute.php (yourapp/app/Plugin/Usermgmt/Lib/routes/SlugRoute.php).
For this I have added strong username validations so user cannot have username like controller name, plugin name, your custom route name etc.

9. Browser Cache Controll
I have added a feature to controller browser cache. Do you know what happens?? when user browse your site with diff-diff browsers then browsers stores CSS and JS cache internally. Now if you make any changes in CSS or JS file then next time user's browse your site then they do not see changes due to browser cache. So I have solution for this issue. I have added a setting in All Setting page for query string no. You have to increase this no by 1 every time you make changes in any CSS or JS file.

How to use this feature
<link href="/umpremium/usermgmt/css/umstyle.css?q=12345678" type="text/css" rel="stylesheet"> OR
<?php echo $this->Html->css(array('/usermgmt/css/umstyle.css?q='.QRDN)); ?>

<script src="/umpremium/usermgmt/js/um.autocomplete.js?q=12345678" type="text/javascript"> OR
<?php echo $this->Html->script(array('/usermgmt/js/um.autocomplete.js?q='.QRDN)); ?>

Where
q is query string
QRDN is query string value which can be managed from All Settings page.

10. Send Emails
You can send emails to registered users and other email addresses. For this click on Send Emails link in admin area now you will have input fields for email information. All input fields are self explanatory. Rich text editor is added for message like gmail. You can send HTML message with the help of this editor. You also have a quick option to send email to any registered user from All Users page.

11. Send Emailer
With the help of this rich text editor you can send your company emailer(a html templates) registered users and other email addresses. For this you need to click on HTML icon in rich text editor top portion(6th icon in 2nd row) then a pop up window will open and you have to paste html code of emailer in that. Now you are ready to send the mail.

12. Placeholder for input text fields
you can use HTML placeholder attribute of any input field. It will work for all browsers and ajax validations. For more information of placeholder see the next line-
<?php echo $this->Form->input('email' ,array('label'=>false'placeholder'=>'Email'))?>

13. A small CMS for creating Static Pages
You can add/edit/delete/view static pages from admin area. For this you need to click on All Pages link. After adding a page you will get a link and you can put this link anywhere on the site.

14. A contact us form is added to this plugin
Now you have contact us enquiry form element in this plugin. You can put it any where in the site. for e.g.
<?php echo $this->element('Usermgmt.contact_us'); ?>

All contact enquiries will save in database and will mail to admin email address. Please update Admin Email Address in All Settings page. You can reply to any enquiry from All Contact Enquiries page.

15. Tinymce Editor
You can use Tinymce editor in following way
Include Tinymce helper in controller's Helper variable for e.g.
public $helpers = array('Usermgmt.Tinymce');
In View file you can use tinymce editor for textarea <?php  echo $this->Tinymce->textarea('UserEmail.message', array('type' => 'textarea'
'label' => false'div' => false'style'=>'height:800px'), array('language'=>'en'), 'umcode');?>
where 'umcode' is configurable for textarea toolbar. Possible values are 'full', 'basic', 'simple', 'umcode'