Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Help with user registration, attempting to include SSO options directly on registration page

I'm trying to make a modification to the user experience during the registration process. The idea is to move the SSO (Facebook, Google, Twitter) signup buttons to the same page as the registration form. I'd like to display the options side by side, similar to how they are displayed when a user clicks on the sign in link (in the popup, one side is the form, the other side is the SSO buttons).

I attached a quick / dirty mockup of what I want to accomplish below

I require captcha on my installation, so I am making modifications to dashboard>views>entry>registercaptcha.php. I'm not an expert php programmer, so please excuse any naive assumptions I might be making - I'm approaching this as a way to learn some new tricks while figuring out a non-ugly-hack.

I'm able to get the small buttons to display in the registercaptcha.php view by copying this from views>modules>guest.php

<?php $this->FireEvent('BeforeSignInButton'); ?>

This works, but ideally I want to use the larger buttons that are displayed on views>entry>signin.php entry. Also, it seems a bit ugly to reuse the same function that is really meant for the guest panel.

I've been digging around to try and see what makes the 'BeforeSignInButton' event.. So far I've found that each SSO plugin contains a function called Base_BeforeSignInButton_Handler, and that is what seems to build the icon links.

Should I simply modify each plugin and add a new/similar function, but with the larger images instead? If that would work, if I were to call it Base_SSOEntrySignInButton_Handler, would I then be able to run that with $this->FireEvent('SSOEntrySignInButton'); in the registercaptcha.php view.... or would I need to declare that somewhere else?

Or - am I going about this entirely the wrong way?
Thanks for any tips or guidance!

Comments

  • I require captcha on my installation, so I am making modifications to dashboard>views>entry>registercaptcha.php.

    you should copy your view into a plugin or theme - not modify the core. (in the same manner as botstop plugin)

    change the class on the button for bigger buttons I would assume.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Right, I am copying all changes into a custom theme. Sorry, I should have mentioned that.
    I was just showing the path of the file so that it was easily identified.

    Are you saying change the php class, or the css class?

    The buttons seem to be create with functions inside the plugins. For example, this is the twitter plugin version:

    private function _GetButton() { $ImgSrc = Asset('/plugins/Twitter/design/twitter-icon.png'); $ImgAlt = T('Sign In with Twitter'); $SigninHref = $this->_AuthorizeHref(); $PopupSigninHref = $this->_AuthorizeHref(TRUE); return "<a id=\"TwitterAuth\" href=\"$SigninHref\" class=\"PopupWindow\" title=\"$ImgAlt\" popupHref=\"$PopupSigninHref\" popupHeight=\"400\" popupWidth=\"800\" ><img src=\"$ImgSrc\" alt=\"$ImgAlt\" /></a>"; }

    That is called by

    `public function Base_BeforeSignInButton_Handler($Sender, $Args) {
    if (!$this->IsConfigured())
    return;

        echo "\n".$this->_GetButton();
    

    }`

    So, if I want my own set of custom buttons, I need to make my own custom functions in the plugin files... and would that be a logical step?

    Thanks again

  • hgtonighthgtonight ∞ · New Moderator

    Add a custom event in your custom views where you want the buttons to appear. Something like $this->FireEvent('BeforeRegistrationForm');. Then modify each of the SSO provider plugins by adding a handler for this custom event. Something like this in each plugin:

    EntryController_BeforeRegistrationForm_Handler($Sender) {
      $this->Base_BeforeSignInButton_Handler($Sender);
    }
    

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • hgtonighthgtonight ∞ · New Moderator

    Just to clarify, I assumed you were adding these buttons via /themes/YourCustomTheme/views/entry/registercaptcha.php. If you are adding it to any other controller, modify the plugin event handler name appropriately.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • peregrineperegrine MVP
    edited October 2013

    Are you saying change the php class, or the css class?

    css.

    you could either add a class to the buttons via jquery on the particular page and have a css class in your custom.css. or add a height and width via .css() or attr() query.

    I don't use any of the plugins - but it seemed like an option if you want to change things.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • carmoliocarmolio
    edited October 2013

    Soooooo I experimented with both options!

    I started out by trying to modify the plugin, but it didn't seem to work.
    Nothing broke, but nothing really changed either. I added a function called

    EntryController_BeforeRegistrationForm_Handler
    

    in the plugin, but there was no output when I tried to run

    $this->FireEvent('BeforeRegistrationForm')
    

    .... Probably need to do a big more digging. I'd like to keep experimenting with that, but I am under a bit of a time crunch to get this completed.

    So for now, I ended up adding a bit of jquery, as peregrine suggested, and styling to make it look like buttons. This seems to be working pretty well enough for now.

    Thanks for all the tips!

Sign In or Register to comment.