GWed
GWed

Reputation: 15663

Joomla additional User Data

Im trying to create some new extensions in joomla.

I want to add additional information for each user. I know I could achieve this by creating my own custom user profile plugin and adding additional fields, but this will then add those fields to the users profile page.

I want to show the new fields separately. For example i may have one link on the users page which takes them to there basic information e.g. name, email etc. And another link which shows them the 'additional' fields.

The additional fields will not be personal information, that's why I want to display them separately.

My question is, how do I achieve this? Can I simply add additional fields to each user or will I have to write a completely new component?

UPDATE: I cannot use an existing extension as I want full control over the code. Also, the additional information will NOT be added by the user, it will only be added by admin.

Upvotes: 0

Views: 573

Answers (4)

GWed
GWed

Reputation: 15663

In the end I decided it was better to create my own component. Mainly because hacking joomla would be a pest when updates came out and JED did not provide the specific extension that I wanted.

Upvotes: 1

Elin
Elin

Reputation: 6770

You do not have to display profile fields on the user profile page with the standard user profile You can configure it only to display to the administrator. You simply make different settings for the different forms (there are 4 throughout the cms). Follow the pattern in the core plugin.

Upvotes: 1

Basith
Basith

Reputation: 1075

If you have added or changed any coding like adding fields to user table or customize registration page in joomla it will restore to default once you upgrade your Joomla version. The way to do this is:

  • You have to create another table which contains the other extra information and should with userid from #__users.
  • When submitting the form you have get the another table by using this Joomla code.

$module_table = JTable::getInstance('modules', 'profileTable');

  • Modules -> means table name which you created.

  • ProfileTable -> means "component name" is Model name and "Table" is common.

Then you have to pass the post values to this table like this..

if (!$module_table->bind($post))
    {
        return 0;
    }
    if (!$module_table->check())
    {
        return 0;
    }
    if (!$module_table->store())
    {
        return 0;
    }

This way, you can store additional data for users. For displaying purposes, you will need to join the two tables by using userid and display it...

All the best..

Upvotes: 0

Lodder
Lodder

Reputation: 19733

There are probably 2 main way of doing this.

  1. You can create an extension where user fill in the information and it stores the data in separate database table which connects to the #__users table.
  2. You could download an extension from JED for extended profiles. There are non-commercial and commercial extensions so take a look here to see if there is anything that might suit your needs.

Personally I would install a pre-made extension and it will save a lot of work/trial and error.

check this out: http://extensions.joomla.org/extensions/clients-a-communities/user-management

Upvotes: 0

Related Questions