Social Network Connect Events

The following is the list of the social network connection events and where they happen:

On Controllers

How to Work With Social Network Connect Events

This event when triggered will contain a Da\User\Model\User model instance and also a Da\User\Model\SocialNetworkAccount instance. For example:

<?php 
// events.php file

use Da\User\Controller\RegistrationController;
use Da\User\Event\SocialNetworkConnectEvent;
use yii\base\Event;

Event::on(
    RegistrationController::class, 
    SocialNetworkConnectEvent::EVENT_BEFORE_CONNECT, 
    function (SocialNetworkConnectEvent $event) {

        $user = $event->getUser(); // $token is a Da\User\Model\User instance
        $account = $event->getAccount(); // $account is a Da\User\Model\SocialNetworkAccount

        // ... your logic here
    });

© 2amigos 2013-2017