rodrigoprimo / social-connect

WordPress plugin for signup/login using social media providers.
http://wordpress.org/extend/plugins/social-connect/
GNU General Public License v3.0
73 stars 40 forks source link

Allow for custom user_login values and enqueue styles correctly #76

Open haroldkyle opened 9 years ago

haroldkyle commented 9 years ago

Fixes #41

The open issue #41 suggested making this an option in the settings, but this could lead to confusion. (An option might mislead administators that they are making email addresses the user_login for everyone on the site, when this would only affect new registrations via SSO.)

Instead, I have introduced a filter that gives developers (who will know better, right?) the ability to modify the user_login value before the new user is inserted. In the case of creating an email login, they can just add this to the functions.php:

add_filter('social_connect_user_login', function( $user_login, $sc_email, $sc_first_name, $sc_last_name, $social_connect_provider ){
    return $sc_email;
},10,5);

Quick, painless, and solves the problem at hand. :)

haroldkyle commented 9 years ago

Added code to enqueue styles properly so they don't get printed out at the wrong time. WP documentation says this needs to happen in wp_enqueue_scripts.

Also, dependencies need to be specified in script registration.