views:

716

answers:

1

Hi Everybody

I am creating a component where registered users will be able to use the features of my component.

My component has a some forms and views. I want to allow only logged in users to access links to my component.

How can i add extra custom fields to the User Registration form of Joomla? I have some extra fields to capture like address and company name.

How can i integrate the authentication with my component?

How can i accomplish my component without creating again the functionality of User registration and authentication. As i know that i can use joomla user registration and integrate it with my component. But i Dont know how to do it.

Kindly Help Thanks

+1  A: 

There are lots of ways you can accomplish that. OFC best methods are always integrating without doing core hacks. That said i would suggest two ways.

There are lots of plugins or components which extend the user registration fields. But these are solutions on themselves, so it will be of no use for your component which holds own data (adress, company, etc.).

  1. You simply create a registration frontend view for your component using the joomla users model. That way users can register thru your component and add all extra fields you like. You just have to take care to add the non standard fields to your db tables in the model.

  2. If you realy dont want to create a registration form on your own, you can create an User Plugin in combination of an content override for the registration form. The plugin would than take care of adding the extra fields to your db tables. The correct User Event would be:


function onAfterStoreUser($user, $isnew, $success, $msg) {
   ...
   if ($isnew)
   {
      myComponent::createExtraFields($user['id'], $args);    }
   else
   {
      myComponent::updateExtraFields($user['id'], $args); 
   }
   ...
}
Mike