1

I am tring to override Joomlas function to not allow duplicate email addresses. I know the security issues surrounding this but its I will have to have users with the same email address.

My users are mainly older people and often share a household email address.

I have found where it checks this in the JTableUser class in the check method at line 236

// Check for existing email
    $query->clear()
        ->select($this->_db->quoteName('id'))
        ->from($this->_db->quoteName('#__users'))
        ->where($this->_db->quoteName('email') . ' = ' . $this->_db->quote($this->email))
        ->where($this->_db->quoteName('id') . ' != ' . (int) $this->id);
    $this->_db->setQuery($query);
    $xid = (int) $this->_db->loadResult();

    if ($xid && $xid != (int) $this->id)
    {
        $this->setError(JText::_('JLIB_DATABASE_ERROR_EMAIL_INUSE'));

        return false;
    }

Is there a way to override this class at a component level?

Thanks

Lee

1 Answer 1

2

You can override some classes with a system plugin, see here

Or you can create your own authentication plugin, based on an extra field (you could choose one in the user profile plugin to use for that purpose), i.e. save the shared email as an extra field; then do the custom check).

This would only work for authentication (after that, Joomla would use the normal i.e. wrong email field) I'm not sure this is what you want to achieve.

1
  • Hi, Thanks for your help on this, I have built a plugin that overrides the core User Table class. I don't like it but it works. I really hope they create an option to have unique emails as an option. What's the best way to request a feature these days? Aug 25, 2015 at 10:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.