'https://n-1.cc/openid/', 'Ecoxarxes' => 'https://cooperativa.ecoxarxes.cat/openid/', 'Anillosur' => 'https://anillosur.cc/openid/', // ... )); // don't let OpenID users set their passwords elgg_register_event_handler('pagesetup', 'system', 'openid_client_remove_password'); // the return to page needs to be public elgg_register_plugin_hook_handler('public_pages', 'walled_garden', 'openid_client_public'); } /** * Set the correct subtype for OpenID users * * @param ElggUser $user New user * @return void */ function openid_client_set_subtype($user) { $db_prefix = elgg_get_config('dbprefix'); $guid = (int)$user->getGUID(); $subtype_id = (int)add_subtype('user', 'openid'); $query = "UPDATE {$db_prefix}entities SET subtype = $subtype_id WHERE guid = $guid"; update_data($query); } /** * Remove the password view from the account settings form */ function openid_client_remove_password() { $page_owner = elgg_get_page_owner_entity(); if ($page_owner && elgg_instanceof($page_owner, 'user', 'openid')) { elgg_unextend_view('forms/account/settings', 'core/settings/account/password'); } } /** * Add pages to the list of public pages for walled garden needed for OpenID * transaction * * @param string $hook Hook name * @param string $type Hook type * @param array $pages Array of public pages * @return array */ function openid_client_public($hook, $type, $pages) { $pages[] = 'action/openid_client/login'; $pages[] = 'mod/openid_client/return.php'; $pages[] = 'action/openid_client/register'; return $pages; }