PHP code example of pessek / elgg_hybridauth
1. Go to this page and download the library: Download pessek/elgg_hybridauth library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pessek / elgg_hybridauth example snippets
// 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
}
}