Drupal Association members fund grants that make connections all over the world.
Description of HybridAuth 7.x-2.x branch.
This new branch implements the architecture and approach I used for uLogin module (which is now a 7.x-1.10 release already), but for HybridAuth.
- Removed hard dependency on Libraries, it will use it if available, but Libraries module is not required (see _hybridauth_library_path() function)
- Added dependency on Ctools; it is used for icon packs plugins and overlay
- HybridAuth widget is now a form element (implemented using hook_element_info). It allows to add it to any form just by adding an element with '#type' => 'hybridauth_widget'. It also automatically includes css and js files using '#attached' property.
- Reworked and simplified theme layer, it is now much less and much cleaner code. All inline js code that was added in template_preprocess functions was moved to js file added via '#attached' property.
- Icon packs are done as ctools plugins. Icon pack plugin is basically a plugin name + css file with paths to the icons. It is auto-discovered by ctools and added to the module administration form for selection. Both modules and themes can provide their own icon packs. Maybe we should also allow to add their own js files here for some custom behaviors.
- Overlay functionality is now done via Ctools overlay with custom settings and theme, all colorbox-related code was removed.
- User creation functions were completely reworked, it is now using the Drupal core user_external_login_register() function to create a user and doesn't use a registration form. So it doesn't need to use session to handle the data between page reloads. The user is just being created and logged in, in one click.
- Token integration - tokens are provided for every value exposed by HybridAuth library; it allows to use Rules to fill in user profile fields using this data (so no need for custom field mapping code and administration forms - all is done via Rules)
- Rules integration - condition to check if a user was created through HybridAuth; 2 events - user added / deleted hybridAuth identity; 1 action - fetch external image by URL and create manageable file object - so that user image can be placed to any user image field, not just into user picture.
- Reworked administration forms - removed tabs (LOCAL_TASK), now one single hook_menu entry to rule them all; implemented Vertical tabs; added much more settings (basically, migrated all the best stuff from uLogin code)
- Identities management - any user with 'use hybridauth' permission can add/remove identities to/from his account. Even already registered users can add identities and start to login using them into their old good account.
- User tokens browser for any attached identity - any admin having 'administer site configuration' or 'administer users' permission can browse all the values for any identity attached to a user profile on the HybridAuth tab of this profile
- Widget logic is clean and simple - if anonymous user click on it, then we should login; if logged in user clicks it, then we should add identity to this logged in user account.
Things to notice:
- DB table was completely changed, there is no upgrade path from 7.x-1.x version. All DB operations are wrapped into functions.
- Preferred provider feature, based on the cookie, was removed. It might be added back later if required, but it was just too much added complexity with almost no added benefit to support it. Plus for real sites with huge traffic most anonymous requests are cached, and the way it was implemented could confuse users (they might receive the provider they didn't really use)... we might figure out another way to implement this so it does support the cached case.
- The destination feature is not implemented (as I think)... there is a setting in the administration form, but I didn't throw in the code to actually use this variable.
This is it :) There might be more things to describe... Just to draw a line - this 7.x-2.x version is fully working, the code is production ready (as it uses the tested and working code from uLogin module) - try it and let me know how it tastes :) I'm ready to roll out the 7.x-2.0 release (maybe add js support for icon pack and make the destination feature working).