2

I have currently a joomla3 install, and I want to overwrite the server-side validation, and the clientside validation of the username (I only want users to be able to sign up with a phonenumber)... How can I overwrite these two things, most easily?

Thanks in advance :)

EDIT: Oh yeah, and what I might have forgotten to mention, is that I am working on a previous joomla1.5 install, we are migrating to joomla3.0, and a lot of bad conventions (like overwriting core files, copying of entire functions, and other code) have been used... I am merely trying to get on with the migration, without having to edit alot of stuff...

So I am trying to maintain the structure, that the username, is the phonenumber, to not have to change alot of things, that can't be automated

migrated from stackoverflow.com Oct 20 '14 at 10:36

This question came from our site for professional and enthusiast programmers.

  • You have to take a look at this list: extensions.joomla.org/extensions/access-a-security/site-access/… – emmanuel Oct 17 '14 at 12:08
  • Hi, and thanks for your reply. Is it not possible to develop something myself, instead of using an external extension?.. I mean, I hope it is possible to do this, just creating a user plugin. I see the current code for validating a username is in FormRuleUsername libraries/joomla/rule/username.php.. Is it not possible to create an extended class of that, and make the system use that instead? – user1898027 Oct 17 '14 at 12:39
  • I am not sure if that would be easy to be done with a custom plugin as e-mail and password are mandatory to create an account in joomla and you have to bypass all validations. – emmanuel Oct 17 '14 at 15:19
  • That saddens me, but it was also the conclusion I came to, when looking through the joomla code :( I am still hoping someone else has a simple solution though. Small hacks are acceptable too, as long as I don't have to edit core files – user1898027 Oct 17 '14 at 17:43
  • So is the issue that the validation rule won't accept all numbers? – Elin Oct 18 '14 at 1:43
2

This is precisely what writing a custom Authentication Plugin is for. Joomla installs an LDAP example to work from, and writing your own is really quite simple. I actually cloned the entire com_users component as "com_students" which treated everything just the way I wanted, allowing authentication with Student IDs and phone numbers. From there, I could use the standard com_users, my com_students, as well as the initial Authentication plugin that I wrote.

  • I see what you mean, and I think that is a good solution that I might go with, but the only problem is when the core joomla files are changed for the users component, the updates doesn't take effect... So it is basically the same thing as editing the core files, except we do not loose code when the update happens. But I guess it is the only way to do this, so I will probably go with it, unless someone else has another idea. – user1898027 Oct 18 '14 at 11:25
  • Well, we didn't change the component drastically, just the authentication, and the language strings really, so it's not too major when comparing - good luck. – GDP Oct 18 '14 at 12:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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