Joomla 1.6 user registration (selection of user groups)

887 views
Skip to first unread message

hasan

unread,
May 31, 2011, 9:32:22 AM5/31/11
to Joomla! General Development
Hi!

I have made few changes in the registration page and added user groups
to the form so that users can select only specified user groups shown
in drop down menu. I am unable to find the place where i can store
user group information into jos_user_usergroup_map table so users will
be alotted selected group. Thanks in advance.

/Hasan

hasan

unread,
May 31, 2011, 10:49:29 AM5/31/11
to Joomla! General Development
I solved it by myself. I know it is very odd way to solve it but for
the time being I solved it. I added another field type "sql" and using
query I fetched my desired groups to form in dropdown menu. I made
changes in components/com_user/models/registration.php in register
function. I added $data['groups'][0]=$data['mygroups'];

After this. My users can select their own group and get their own
profiles depending upon their own group.

cheers
/Hasan

steve carter

unread,
Sep 8, 2011, 6:44:28 AM9/8/11
to joomla-de...@googlegroups.com
Hi i am trying to do the same thing so a user can choose from a predifined groupe eg seeking services and service provider but not having any luck would anyone be able to explain how to do this please joomla 1.7

many thanks steve

Nicholas K. Dionysopoulos

unread,
Sep 8, 2011, 8:19:10 AM9/8/11
to joomla-de...@googlegroups.com
Hi Steve,

This is not possible using just the core functionality of Joomla!. Joomla! will only allow you to select one group to automatically put all users in. You can either use an extension which adds additional profile fields to the user registration (if you don't really need the Joomla! user groups' functionality) or use a subscriptions extension which is capable of placing users to different user groups, depending on their subscription status.

In the latter case, I can only tell you about the subscription component I have build, Akeeba Subscriptions, which does have this feature (and it's free of charge). If you assign a price of 0 to a subscription, you can use it for the exact purpose you seem to have in mind. If it's something that interests you, please contact me off list so that we don't get to spam the other participants with our chit-chat :)

Cheers,

-- 
Nicholas K. Dionysopoulos
Lead Developer, AkeebaBackup.com

On Thursday, 8 September 2011 at 13:44, steve carter wrote:

Hi i am trying to do the same thing so a user can choose from a predifined groupe eg seeking services and service provider but not having any luck would anyone be able to explain how to do this please joomla 1.7

many thanks steve

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To view this discussion on the web, visit https://groups.google.com/d/msg/joomla-dev-general/-/w-FzQuURhVEJ.
To post to this group, send an email to joomla-de...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-gene...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/joomla-dev-general?hl=en-GB.

hasan

unread,
Sep 8, 2011, 11:05:44 AM9/8/11
to Joomla! General Development
Hi!

here is the work. I know this is hack but it worked for me for the
time being. I am also new to joomla development. I am working to use
over ride method so that we donot need to hack joomla core. Here is
the code which I used to fix this problem in joomla 1.6

Hi!

You go like that.

1. edit /components/com_user/models/forms/registration.xml

I added sql field like

<field name="group" type="sql"
description="Select your group"
filter="string"
label="Select your group"
query="select id as id, title as til from jos_usergroups where id =
10 or id = 9 or id = 12 or id = 13 order by title asc"
key_field="id" value_field="til"
message="COM_USERS_REGISTER_NAME_MESSAGE"
multiple="no"
required="true">
<option value="">Select group</option>
</field>
the important that is that field name is the same corresponding field
in the database. I have not tested but you can checked it and I
followed the same way. There is field 'group' available in jos_user
table. you can select what ever groups you want to bring to front end
through query.

2. then edit components/com_user/models/registeration.php in register
function at line 306 add

$data['groups'][0]=$data['group'];
That's it.
3. Donot forget to give permissions to user groups to login through
front end.
Go to back end site administration and go to users page there you will
find options button on top right corner. You will be able to see your
news user groups there and give permission to your usergroups for site
login.

this code bypasses the default group Id which is registered group. and
save new group id in jos_user_usergroup_map table against user id.

Hopefully, It will help you.

Best regards,
/Hasan


On Sep 8, 2:19 pm, "Nicholas K. Dionysopoulos" <nikosd...@gmail.com>
wrote:
> Hi Steve,>
>  This is not possible using just the core functionality of Joomla!. Joomla! will only allow you to select one group to automatically put all users in. You can either use an extension which adds additional profile fields to the user registration (if you don't really need the Joomla! user groups' functionality) or use a subscriptions extension which is capable of placing users to different user groups, depending on their subscription status.
>
> In the latter case, I can only tell you about the subscription component I have build, Akeeba Subscriptions, which does have this feature (and it's free of charge). If you assign a price of 0 to a subscription, you can use it for the exact purpose you seem to have in mind. If it's something that interests you, please contact me off list so that we don't get to spam the other participants with our chit-chat :)
>
> Cheers,
>
> --
> Nicholas K. Dionysopoulos
> Lead Developer, AkeebaBackup.com
> Web:http://www.AkeebaBackup.com
> Blog:http://www.dionysopoulos.me/blog
>
>
>
>
>
>
>
> On Thursday, 8 September 2011 at 13:44, steve carter wrote:
> > Hi i am trying to do the same thing so a user can choose from a predifined groupe eg seeking services and service provider but not having any luck would anyone be able to explain how to do this please joomla 1.7
>
> > many thanks steve
> >  --
> >  You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
> >  To view this discussion on the web, visithttps://groups.google.com/d/msg/joomla-dev-general/-/w-FzQuURhVEJ.
> >  To post to this group, send an email to joomla-de...@googlegroups.com (mailto:joomla-de...@googlegroups.com).
> >  To unsubscribe from this group, send email to joomla-dev-gene...@googlegroups.com (mailto:joomla-dev-gene...@googlegroups.com).

elin

unread,
Sep 8, 2011, 1:19:29 PM9/8/11
to joomla-de...@googlegroups.com
Are you using the groups to control view access, actions, both or neither?

Do you want to allow multiselect?

Do you want the groups to inherit from a common default group?

Do you want users to be able to self update this later? 


Elin


steve carter

unread,
Sep 8, 2011, 2:30:25 PM9/8/11
to joomla-de...@googlegroups.com
Hi Hasan first of all i would like to thank you for taking the time to write back to me

i will try and do the same as you have discribed and will get back to you let you know how i get on!
 little confused over the first bit do i need to add the groups in the sql data base or will it pull them from the data base of wich i added from backend of joomla! hope not acting thick!
either way will give it a go !

once again thank you for your time

steve

steve carter

unread,
Sep 8, 2011, 2:39:11 PM9/8/11
to joomla-de...@googlegroups.com
hi Elin
 
for example two groups seaking services and service providers

so when a service provider registers they will be able to add to sobi pro data base etc

and seeking service people wouldnt see this form poss even be able to fill in diferent form seeking etc

not able to multiselect or to change in profile edit

this is not all about acl and must be on registration as by the time admin approved and put into diff groups they prob wouldnt come back n fill in there profiles!

hasan

unread,
Sep 9, 2011, 6:16:38 AM9/9/11
to Joomla! General Development
Hi Steve!

You donot need to add anything. If I explain in words, I just added
one field to the registration form and used sql data type to bring
desired user group to the registration form. I did't check with
multiple selection. If we use multiple selection then it will return
array of selected users. For that, we need to save array in the
database.

If you have any problem you can contact me.

/Hasan

steve carter

unread,
Sep 9, 2011, 9:10:50 AM9/9/11
to joomla-de...@googlegroups.com
 Hi Husan i tried your method and it worked!! thank you for your help

many thanks steve

rainweb

unread,
Dec 9, 2011, 7:15:55 AM12/9/11
to joomla-de...@googlegroups.com
Thanks Hasan for your tip.
For multiple select i solved in this way
in /components/com_user/models/forms/registration.xml i add a new field

<field name="sel_group" type="sql"
            description="Seleziona l'area di interesse"
            filter="string"
            label="Area di interesse:"
            query="select id, title from #__usergroups where id = 9 or id = 10 order by title asc"
            key_field="id" value_field="title"
            message="COM_USERS_REGISTER_NAME_MESSAGE"
            multiple="true"
            required="true"
            default="">
            <option value="">Seleziona</option>
        </field>

and in components/com_users/models/registration.php i add a loop control

// Prepare the data for the user object.
       
        foreach ($_POST[jform]['sel_group'] as $i => $value) {
            $data['groups'][$i]  = $value;
        }

hasan

unread,
Aug 23, 2012, 8:38:08 AM8/23/12
to joomla-de...@googlegroups.com
Hi!

There are seven profile.php files in joomla. Can you narrow down the path and elaborate more?

/Hasan

On Wednesday, 22 August 2012 20:10:47 UTC+2, Otaks wrote:
Is possible adding groups field in profile.php?

elin

unread,
Aug 23, 2012, 1:52:32 PM8/23/12
to joomla-de...@googlegroups.com
You can add whatever fields you want to a profile plugin.  The plugin there is just an example, in fact you can make your own and add fields or even more powerful  add additonal xml files to it and programmatically control which users see which fields in which contexts (there are 4 places in the core where the form is displayed if I remember correctly).

You can use js to  dynamically add fields to the form based on a selected  value. We used to do this in the menu manager, now we do it with a page reload when you pick he menu item type, which is also something you can do.

Elin

sri atm

unread,
Aug 23, 2012, 8:53:18 AM8/23/12
to joomla-de...@googlegroups.com
hi all.....iam new to joomla ..i would like to create a new testimonial module...
  will anybody help me please...
thnx in advance
--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To view this discussion on the web, visit https://groups.google.com/d/msg/joomla-dev-general/-/xPvUZr-Ro4AJ.

To post to this group, send an email to joomla-de...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-gene...@googlegroups.com.

Otaks

unread,
Aug 24, 2012, 12:04:08 PM8/24/12
to joomla-de...@googlegroups.com
please help me...is very important

ahmad balavipour

unread,
Sep 19, 2013, 8:04:00 AM9/19/13
to joomla-de...@googlegroups.com
Hi oktas dont forget to change table name to #__usergroups. i have same problem like you.

Fedor Vlasenko

unread,
Sep 20, 2013, 6:41:11 PM9/20/13
to joomla-de...@googlegroups.com
Plug-in of addition of groups for registration, registration in one cliques
We add groups for registration and we delete not the necessary fields
I bring to your attention a User Smiley group plug-in
Main actions of a plug-in of registration
Addition of a field of a choice of group for registration. Possibility of a choice of groups for registration
To clean the field Name. The field a name won't be shown. It will be replaced with a name from mail
To clean the field Login. The field login won't be shown. It will be replaced with the postal address
To clean a field the Password. The field the password won't be shown. The password will be created automatically
To clean to confirm the Password. Field to confirm the password it won't be shown
To clean to confirm Email. Field to confirm Email it won't be shown

In the most minimum option there is only a field email. The plug-in works with a standard form of registration.
To Prednaznachen for Joomla 2.5 - 3
Your wishes and recommendations I am always glad to hear
Use on health
forgive for my language
Reply all
Reply to author
Forward
0 new messages