Joomla 1.5 Advanced Registration

Source can be found here.

What if you need something more than the default registration form in Joomla? Like for instance adding mobile phone validation, zip code and many more custom fields. Then you could make your own component that extends the functionality of the normal default user component and that is what this tutorial is all about.

Quick how to:

1.) Start with copying the current com_user folder and name it com_extendeduser, edit the xml description file to reflect the changes.

2.) Make an sql file with the sql needed to create the new table jos_extuser. Zip it up and install in the Joomla backend.

3.) It’s time to start coding. We start by making an extension to JTable in the models folder of our new component, we call the class TableExtUser and it should contain member variables that match the field names in the databse exactly. All except the password which we call $_password. Next we add some methods, many are extensions to the JTable.

4.) Next we create some display functions to make the view file look as clean as possible. It will be a kind of poor man’s Smarty. Anyway we create these utility functions in the view.html.php file in the register folder.

5.) Now we can edit the default.php file in register/tmpl/ and use our newly created display functions. We also create some new views, for instance a form where the user is prompted to enter a valid code which she should have gotten as an SMS to her phone.

6.) Then we modify the controller in controller.php. This is done mainly by working with the register_save() function in order to save to our new extended user table as well as to the default user table. We also add a few functions and change in some more places. To see everything you could use kdiff and examine how the file in our new component differs from the equivalent in com_user.

7.) Finally we create a new login module called mod_extlogin which basically is just a tiny mod of mod_login in order to route some stuff to our extuser component instead of the normal user component.

8.) Now you are ready to use your new fancy registration form while at the same time letting the out of the box code do as much as it can. A big example is email validation which we just left to the default logic of Joomla.

9.) Optional: Drop necessary language files in the com_extendeduser folder.

I hope this will help all you people who are thinking about charging people for high quality content through their mobile phones.

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • blogmarks
  • Reddit
  • Simpy
  • StumbleUpon
  • Technorati
  • DZone
  • Ma.gnolia

Related Posts

Tags: , ,

11 Responses to “Joomla 1.5 Advanced Registration”

  1. LifeDancer Says:

    Hi,
    Thanks!!
    This really helped me.
    Keep blogging!

  2. HOSSAIN Says:

    i am extreemly new to the joomla and i really didnt understand what you have said but i need a registration form which contain a lot more field then the joomla defult one have . so if you kidly tell me where to put the files you gave me it would be great for me i mean

  3. Henrik Says:

    Hossain: Check the Joomla documentation for information like that, it should be readily available, for instance all components are dropped in one folder and modules in another. After that you set them up in the admin backend.

  4. JD Says:

    Hello,

    First off let me thank you for this extension. Secondly how do I get it to work.lol I dl’ed the package, manually installed the files etc, ran the .sql (no problem, table created). Now I am not sure if your instructions above reference the dl’ed files… or if they are supposed to work once installed.

    But as of this moment, I cannot see the module in the module/plugin manager and when I go to the registration page it still is the standard fields showing. Am I missing something here?

    The instructions above are for creating it from scratch or for modifying the dl’ed files?

    Any help would be appreciated.

    Also is it possible to modify the files to accept PayPal payments with the subscription expiration available instead of the cell phone payment option?

    Best wishes and thanks a bunch.

    JD

  5. Henrik Says:

    JD: I think you need to create an XML or something that describes the files in the component and then do install component in the back end. You should be able to easily find documentation about how to do this. I can’t remember how I did this but I think I made some small dummy XML with the bare minimum and then installed with it.

    Keep in mind that this is not something that was intended to be used out of the box but an example for programmers on how to go about creating or modifying Joomla 1.5 components. I mean there is no back end administration for this thing, it’s all hard coded. The IP to the SMS gateway used to validate the cell phone, the cities drop down and so on can only be changed in the source code. You have to change the source to get rid of the fields you do not want and if you can do that you should be able to install the component too :)

    But you should ask yourself why you need Joomla, here is a good CMS discussion. There might be better alternatives out there.

  6. vijay Says:

    thanks for giving this information..
    But i tryed this ,i get an error called 404:component not found.. please tell me what to do..

  7. akmal Says:

    I have no problem with the form, but I got the problem while submit the form… I got errors… It said something cant bind …… Do you have clues?

  8. Henrik Says:

    akmal: I have no idea, you have to debug it yourself since last time I used it I had no problems, check that all the config stuff is correct, passwords to smtp and sms servers if you are using these features. If not then I don’t know…

  9. akmal Says:

    thank you…

  10. kijiwe Says:

    Hi Henrik thanks for this wonderful component.I have a question though.I am creating a website for a conference where authors can submit their abstracts.
    I managed to change the source code (including the sql code) so that when a user is registering they can choose to be either Authors or Reviewers.Authors and reviewers are new groups which i manually created using mysql and they are stored in jos_core_acl_groups table and jos_groups table as well and i can see them in the back end of joomla.in the jos_extuser i added the filed usertype.my question is how do i connect the form with my users database?i mean when they register they can choose either author or reviewer but in the back end it still reflect that they are registered user group because that is the default joomla user group when you register.thank you for your assistance

  11. Henrik Says:

    Good question, from what I can remember I think I simply rerouted the process to my new custom ext_user table, I think I also let the component save to the normal user table, at least #6 seems to indicate this. This process has probably not been changed at all, that means that you might have to basically change the original component which is a mess because if you upgrade your Joomla you might overwrite your changes so try and implement this in the ext code too.

    You simply have to make sure that the stuff you want to implement is saved to the proper tables. Since you have to work with the original user table and/or other tables that reference the user table the stuff will probably have to be implemented as an update after the main insert has been made, try and see if you can hook into the process afterwards somehow.

Leave a Reply