Topic-icon Bug? JLinked not honoring "Hide Email Field on Registration"

Active Subscriptions:

None
Hello: Tried attaching image, but system wouldn't let me (site relaunch?)

In any case, I'm wondering if this is a known bug in JLinked? Here's what's happening:
- I have the "Email Field on Registration" to "Hide", yet it still shows up on the front end.
- I attempt to register using an email address *that is already used in the system*
- I see an error: "The email address you entered is already in use or invalid. Please enter another email address." But...
- NOW, the email address does NOT appear, so I have no way of entering a different email address.

Please help!

Thanks in advance.
The topic has been locked.
Support Specialist
The only time that JLinked will show the email address, if you have it set to hidden, is if the email address that LinkedIn is supplying is one that is already in use by someone on your site. In that case, we blank out the email field and let the user fill it in, like you mentioned. So, that isn't a bug.

However, if you submit and are getting the "email is in use" error message and *then* the field is hidden, that would be a bug since it should still remain visible and editable so the user can fix that problem.

Hope that helps explain,
Alex
The topic has been locked.
Active Subscriptions:

None
Hi Alex, thanks for the quick reply. Makes sense about the email address showing in the case that the address is already registered.*

However, it appears that there is indeed a bug: as I described, upon submitting the form, the error message shows but then, the email field is no longer available. Luckily, I think this is an edge case, but nonetheless, it's a bug. :-) Please add it to your queue!

* Suggestion on this: if the system detects that the email is already in use, it would be nice to show a message to this effect, something like, "Welcome, User. It appears that the email address associated with your LinkedIn account has already been uses on [this site] to create an account. Could it be that you already registered? If not, please specify a different address to create your account." (Overly wordy, but you get the idea...)

Thanks!
The topic has been locked.
Support Specialist
Amy,
You are indeed correct. There is a bug in our code where if you use an email address that's already in the system *and* have 'hide email' enabled, once the form is submitted, the email field will be hidden.

The fix for this is to edit the /libraries/sourcecoast/utilities.php file. At the very bottom, you'll se a function called getDisplayEmail that looks like the following:
static function getDisplayEmail($postData, $email, &$email1, &$email2)
    {
        $postEmail1 = SCUserUtilities::getPostData($postData, 'email1');
        $postEmail2 = SCUserUtilities::getPostData($postData, 'email2');

        if($postEmail1 != '' || $postEmail2 != '')
        {
            $email1 = $postEmail1;
            $email2 = $postEmail2;
        }
        else
        {
            $dbo = JFactory::getDBO();
            $query = "SELECT id FROM #__users WHERE email=" . $dbo->quote($email);
            $dbo->setQuery($query);
            $jEmail = $dbo->loadResult();
            if ($jEmail != null)
            {
                $email1 = "";
                $email2 = "";
            }
            else
            {
                $email1 = $email;
                $email2 = $email;
            }
        }
    }
Replace that entire block with this slightly revised one:
static function getDisplayEmail($postData, $email, &$email1, &$email2)
    {
        $postEmail1 = SCUserUtilities::getPostData($postData, 'email1');
        $postEmail2 = SCUserUtilities::getPostData($postData, 'email2');

        if($postEmail1 != '' || $postEmail2 != '')
        {
            $email = $postEmail1;
            $email1 = $postEmail1;
            $email2 = $postEmail2;
        }
        
        $dbo = JFactory::getDBO();
        $query = "SELECT id FROM #__users WHERE email=" . $dbo->quote($email);
        $dbo->setQuery($query);
        $jEmail = $dbo->loadResult();
        if ($jEmail != null)
        {
            $email1 = "";
            $email2 = "";
        }
        else
        {
            $email1 = $email;
            $email2 = $email;
        }
    }
The specific changes aren't really important. Mainly, this will update the logic to always check the email against a user in the database, which we weren't doing previously. If that email address exists, the email fields will be blanked out and shown.

Please test and let us know how the change goes for you.

Thanks, and sorry for the inconvenience,
Alex
The topic has been locked.
Support Specialist
Oh, and I like the idea of a notice at the top that the email is already in use. I've added that to our issue tracker (as well as the actual bug above). The bug will definitely be fixed in the next release. The notice is something we'll look into 'soon', but I can't guarantee when.

Thanks again,
Alex
The topic has been locked.
Social Stream
Hide. Seek. Play!

Countdown Hide & Seek Game

Countdown, the new hide & seek toy, is available now! Designed and developed by the founders of SourceCoast, it's the perfect toy to get your kids moving at all ages.

Learn More About the Hide and Seek Toy