getGUID(); $subtype_id = (int)add_subtype('user', 'openid'); $query = "UPDATE {$db_prefix}entities SET subtype = $subtype_id WHERE guid = $guid"; update_data($query); } /** * Register login options * * @param string $hook * @param string $type * @param array $menu * @param array $params * @return array */ function openid_client_setup_menu($hook, $type, $menu, $params) { $items = array( 'large' => array( 'google' => '', 'yahoo' => '', ), 'small' => array( 'blogger' => 'toggle', 'wordpress' => 'toggle', ), ); $items = elgg_trigger_plugin_hook('register', 'openid_client:login', null, $items); $priority = 100; foreach ($items as $type => $providers) { foreach ($providers as $provider => $toggle) { $provider_name = elgg_echo("openid_client:provider:$provider"); $options = array( 'name' => $provider, 'text' => '', 'title' => elgg_echo('openid_client:login:instructs', array($provider_name)), 'href' => "action/openid_client/login?openid_provider=$provider", 'is_action' => true, 'section' => $type, 'priority' => $priority, ); if ($toggle) { $options['link_class'] = 'openid-client-toggle'; $options['rel'] = $provider; } $menu[] = ElggMenuItem::factory($options); $priority += 10; } } return $menu; } /** * 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; }