cakemanager / cakephp-whosonline
WhosOnline plugin for CakePHP to check your users activity
Installs: 36
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 4
Forks: 4
Open Issues: 0
Type:cakephp-plugin
Requires
- php: >=5.4
- cakemanager/cakephp-cakemanager: 1.0.x-dev
- cakephp/cakephp: ~3.0
- cakephp/plugin-installer: *
Requires (Dev)
This package is auto-updated.
Last update: 2024-11-06 21:31:11 UTC
README
The WhosOnline plugin for CakePHP 3.0 (and the CakeManager) helps you to watch your registered users. You can see when they're logged in, last seen and more!
You are able to see the following:
- Last login timestamp
- Last seen timestamp
- Total passed logins
- Total failed logins
- Total new password requests
The plugin is especially built for theCakeManager Plugin but is also easy to use without the CakeManager. Read below to change the current events, so you can customize it.
Installation
You can install this plugin into your CakePHP application using composer.
The recommended way to install composer packages is:
composer require cakemanager/cakephp-whosonline
Configuration
You will need to add the following line to your application's bootstrap.php file:
Plugin::load('WhosOnline', ['bootstrap' => true, 'routes' => true]);
Note: You don't need to load the
routes
if you are not using the CakeManager Plugin.
Usage
Component
Add the following to your AppController
to use the plugin-callbacks:
$this->loadComponent('WhosOnline.WhosOnline', []);
Options for the component:
userId
- Path to the users id in the sessionuserModel
- The model of the users. DefaultCakeManager.Users
usermetasModel
- The model of the usermetas. DefaultWhosOnline.Usermetas
lastSeen
- Boolean if we should save the lastSeen-status. Defaulttrue
lastLogin
- Boolean if we should save the lastLogin-status. Defaulttrue
passedLogins
- Boolean if we should save the passedLogins-status. Defaulttrue
failedLogins
- Boolean if we should save the failedLogins-status. Defaulttrue
passwordRequests
- Boolean if we should save the passwordRequests-status. Defaulttrue
events
- Array with all events to use custom events.lastSeen
- Event for when the users is last seen. DefaultComponent.Manager.beforeFilter
passwordRequests
- Event for when an user requests a new password. DefaultController.Users.afterForgotPassword
passedLogin
- Event for a passed login. DefaultController.Users.afterLogin
failedLogin
- Event for a failed login. DefaultController.Users.afterInvalidLogin
Note: Via the
events
configurations you can customize the events for your own application!
Example:
$this->loadComponent('WhosOnline.WhosOnline', [ 'lastSeen' => true, 'failedLogins' => false, 'events.lastSeen' => 'Controller.Users.customAfterLogin' ]);
From now on the component will save all statuses automatically!
Watching
If you want to watch the usermetas, watch the menu-item "Who Is Online" and click on it. You will see a list of recent online users and its data.
Support
-
CakeManager Website - Website of the CakeManager Team. Here you can find everything about us and our plugins.
-
Gitter - Chat Tool for GitHub to talk about issues and new features.
-
GitHub - When there's something wrong, please open a new issue!
-
CakeManager Docs - Documentation about the CakeManager Plugin.
Contributing
If you have a good idea for a new feature, feel free to pull or open a new issue. Pull requests are always more than welcome.
License
The MIT License (MIT)
Copyright (c) 2014 CakeManager by bobmulder
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.