Using Social Login with custom WP login page using earlier action hook

edited November 2015 in WordPress
I'm building a custom login page and when I render the login form with the `wp_login_form` function, no OneAll providers are listed with the form. So, I added `do_action('oa_social_login');` to my template and I'm only seeing "Connect with:" displayed - the provider links are missing.

If I visit the standard /wp-login page, I see the provider links there, which indicates that the settings/config are configured correctly.

I believe this is because I'm calling the oa_social_login action at the wp_loaded hook. If I change my code to use something really late (like wp_footer), I see the provider icons. But I need to handle the form earlier in the action sequence (to allow for some other use cases in page rendering).

Any thoughts on what data I need to make available for the social login to render and function earlier in the hook sequence?

Best Answer

  • Answer ✓
    Wordpress automatically triggers the login_form action when it renders the password field (docs) so that hook is already be happening as part of wp_login_form.

    But after some digging, it seemed that the problem was the helper JS in the header wasnt being loaded, so I just needed to add `do_action('login_head');` to the header of my template file and it's looking good now. So note to future folks adding to a custom login page - dont forget to load the CSS/JS you need!


  • Hi,
    Not familiar with custom login pages, but maybe try do_action('login_form'), as we have a hook to render there (file user_interface.php, line 803 or about).



Please sign in to your OneAll account to ask a new question or to contribute to the discussions.

Please click on the link below to connect to the forum with your OneAll account.