Skip to content

Latest commit

 

History

History
71 lines (50 loc) · 1.45 KB

UserHelper.md

File metadata and controls

71 lines (50 loc) · 1.45 KB

UserHelper

The User Helper has some methods that may be needed if you want to improve your templates and add features to your app in an easy way.

Setup

Enable the Helper in src/view/AppView.php:

class AppView extends View
{
    public function initialize()
    {
        parent::initialize();
        $this->loadHelper('CakeDC/Users.User');
    }
}

Social Login

You can use the helper included with the plugin to create Facebook/Twitter buttons:

In templates

echo $this->User->socialLogin($provider); //provider is 'facebook', 'twitter', etc

We recommend the use of Bootstrap Social in order to automatically apply styles to buttons. Anyway you can always add your own style to the buttons.

Logout link

It allows to add a logout link anywhere in the app.

$this->User->logout();

RBAC link

This function validates if you have access to a link and it displays it based on that.

$this->User->link();

Welcome and profile link

It displays a welcome message for the user including the name and a link to the profile page

$this->User->welcome();

reCaptcha

Handles the reCaptcha input display:

$this->User->addReCaptchaScript();

$this->User->addReCaptcha();

Note reCaptcha script is added to script block when addReCaptcha method is called.