arckinteractive / elgg_hybridauth

HybridAuth Client for Elgg
10 stars 9 forks source link

HybridAuth Client for Elgg

Elgg 2.3

elgg_hybridauth is an authentication tool that allows users to create new Elgg accounts using their social media accounts.

Providers included by default:

Visit http://hybridauth.sourceforge.net/ for more information about HybridAuth library and additional providers that can be added to this distribution.

Features

Upgrades

Provider Setup

Setting up Facebook

Setting up Twitter

Setting up Google

Setting up LinkedIn

Setting up Yahoo!

Set up Live

Set up FourSquare

Developer Notes

Since 1.1.1, you can make use of 'hybridauth:authenticate', $provider plugin hook to perform some actions, when the user is authenticated with a provider. This might be a good place to post stuff to user's wall or to grab a profile picture.

Example of how to post to the user's wall that the user Joined the site:


// do stuff when the user is authenticated with one of the providers
elgg_register_plugin_hook_handler('hybridauth:authenticate', 'all', 'elgg_hybridauth_on_authenticate');

function elgg_hybridauth_on_authenticate($hook, $provider, $return, $params) {

    $user = elgg_extract('entity', $params);

    try {
        $ha = new ElggHybridAuth();
        $adapter = $ha->getAdapter($provider);
        if ($adapter->isUserConnected()) {
            $status = $user->name . ' just joined ' . elgg_get_config('sitename') . ' at ' . elgg_get_site_url();
            $adapter->setUserStatus($status);
        }
    } catch (Exception $e) {
        // Something is wrong
    }
}

Upgrading

To 1.3