I have written a plugin example for login or register using Linkedin, Facebook or Google.

I have written a Elgg plugin for SignIn or Register using Facebook, Google and Linkedin. When plugin is installed, it shows three buttons en LogIn form and Register Form:

Plugin register or login (if user email is already registered) and sets avatar image from his Social Network profile image.

Plugin source is here:

https://github.com/aleamb/social_signin

Plugin code shows:

- Extends views with custom views.
- Extend login form and register forms
- Use elgg actions
- Use sass for generate custom css
- Plugin settings for administration
- Use Call register and login methos from elgg
- Programatically register user.
- Programatically set user's avatar
- Use search functions.


Your feedback will be highly appreciated.

 

  • Looks like a well written plugin.

    A few comments from just browsing through quickly:

    1. Change composer 'type' to 'elgg-plugin'. That will allow anyone to use composer require from the project root and it will install the plugin into /mod

    2. Instead of extending page/elements/head, I would suggest using 'head' hook or simply elgg_register_js() and elgg_load_js() (and only if the login form is shown).

    3. You are loading vendor scripts on each page request, you may want to check if elgg_is_logged_in() and bail early. These scripts are notorious for capturing a lot of data on user interactions and you don't want to give them access to all the pages on the site.

    Not sure if you have seen elgg_hybridauth plugin. It does the same thing but without inviting those horrible JS SDKs on your site.

     

  • Thank you!!, Ismayil

    I didn't know elgg_hybridauth. I will take a look!

     

  • Great plugin! Congratulations!
    I Hope you Will improve It with upgrades suggested by Ismayil , so i will use or for sure.
    (Hybridauth doesn't work with Facebook login, becouse of Facebook). thanks!

  • Another small hint, if you put your classes in a folder called classes/SocialSignInPlugin they can get autoloaded by Elgg.

    The classes folder supports PRS-0 and PSR-4 class autoloading

  • Thank you very much!

     Yes, i will improve the plugin with all the suggested upgrades

     

  • I am running 2.3.7 and when I hit activate for the plugin my site crashed and wouldn't work until i ftp deleted the plugin folder

  • Hi, Herb

    Can you paste or send error logs?

     

  • Sorry can't find it in the logs and don't want to try activating it again