Forums / Developer / register users in different user groups

register users in different user groups

Author Message

Dhaval Patel

Thursday 21 August 2008 4:34:22 am

hello all,

I want to register user in one of the different listed groups.

But i think, ez provides functionality to register user in group by setting in site.ini file.

Is that passoble that
There are three steps of registration.
step-1 list of user groups
step-2 select group from step-1 and open the registration form with the user groups in select box. user can change user group here also.
step-3 varification mail and display his profile after clicking on activation link in email.

step-3 I can make working.

so please suggest me what to do for step-1 and step-2.

Thanks a lot in advance...

Thanking you very very much

Dhaval Patel

With Best Regards,

Dhaval Patel
Team Leader - iNETProcess(I) Pvt. LTD.
dhaval.patel@inetprocess.com
Ph No: +91 79 65 12 35 00
http://www.inetprocess.co.in

Mickael Robin

Monday 06 October 2008 12:54:42 am

Hi Dhaval,

could you find a way to fulfill this need?

Otherwise, I'll try to use different siteaccesses as proposed here http://ez.no/developer/forum/setup_design/two_registration_forms_with_diferent_user_groups/re_two_registration_forms_with_diferent_user_g__4

Thanks in advance for your response,
Mickael

Dhaval Patel

Monday 06 October 2008 2:57:42 am

hi Mickael,

I have changed the /kernel/user/register.php .

The steps will be as follows.

User fills the registration fields in the registration form and also selects the group in which he wants to register.

Now open /kernel/user/register.php

find this line

$object = eZContentObject::fetch( $object->attribute( 'id' ) );

Put the below line after the above code...

// move user to specified group
eZContentObjectTreeNodeOperations::move( $object->attribute( 'main_node_id' ), $http->variable("membership") );

In this code "membership" is the field name of the group in register form.

so what I am doing is "Move user to specified group after registration."

Is this OK for you ?

With Best Regards,

Dhaval Patel
Team Leader - iNETProcess(I) Pvt. LTD.
dhaval.patel@inetprocess.com
Ph No: +91 79 65 12 35 00
http://www.inetprocess.co.in

John Smith

Tuesday 18 August 2009 1:00:59 am

Hi Dhaval,

I am in the similar situation and need bit of guidance if you can. Mate what is best way to display the drop down list on the registration form and then to pull the data in the /kernel/user/register.php. I tried by addition an attribute named as selection in the user class but bit stuck and need your help in pulling the data in /kernel/user/register.php

Have you got some code example.

Cheers

Jean-Luc Nguyen

Tuesday 18 August 2009 1:19:19 am

Hello,

Maybe you can create a publishing workflow that creates multiple locations to groups:

http://projects.ez.no/createmultiplelocationruleevent

http://www.acidre.com

Dhaval Patel

Tuesday 18 August 2009 1:35:02 am

Hi john,

I have just put hard coded combo box into register.tpl by overiding it.

<select name="group_id">
     <option value="{$group_id1}">{$group_name1}</option>
     <option value="{$group_id2}">{$group_name2}</option>
     <option value="{$group_id3}">{$group_name3}</option>
</select>

and in register.php, after creating the user, I just move that created object into group node

      $object = eZContentObject::fetch( $object->attribute( 'id' ) );
      eZContentObjectTreeNodeOperations::move( $object->attribute( 'main_node_id' ), $http->variable("group_id") );

that's all.

With Best Regards,

Dhaval Patel
Team Leader - iNETProcess(I) Pvt. LTD.
dhaval.patel@inetprocess.com
Ph No: +91 79 65 12 35 00
http://www.inetprocess.co.in

John Smith

Tuesday 18 August 2009 1:40:32 am

Hi Jean

Thanks for you kind help. Would it be possible for you to please explain me in bit more detail like how this can be useful in my requirement.

My requirement is to move users to specific user groups while they register.

Looking forward to hear from you soon.

Dhaval Patel

Tuesday 18 August 2009 1:49:09 am

hi,

if you want to allow users to select the group, put select tag into register.tpl file. where user will select the group. let us take example that user selected id=3 (group_name3)

now in register.php

put the code for move

eZContentObjectTreeNodeOperations::move( $object->attribute( 'main_node_id' ), $http->variable("group_id") );

$object denotes the created user object and $http->variable("group_id") denotes the destination group node id.

With Best Regards,

Dhaval Patel
Team Leader - iNETProcess(I) Pvt. LTD.
dhaval.patel@inetprocess.com
Ph No: +91 79 65 12 35 00
http://www.inetprocess.co.in

John Smith

Tuesday 18 August 2009 1:58:36 am

Thank you boss, you are a star, this "eZContentObjectTreeNodeOperations::move" did a trick. It is all working.

Did you get my email as well.

Keep in touch mate.

Jean-Luc Nguyen

Tuesday 18 August 2009 2:47:33 am

If this is solved, great.

Just for info, I supposed that when a new user is register, it is put under group A, as primary location. The extension I made permits to create secondary locations after publication (workflow); the user is still put under group A as primary location, and also put under group B and C (B and C are configured in a INI file) as secondary locations.

http://www.acidre.com

John Smith

Wednesday 19 August 2009 8:52:47 am

@Dhaval

Can you please confirm few things after checking the database.

If you delete the user which has been moved to the specified user group while registration process, it is leaving the row blank.

Please check ezuser table in the database.

Please confim.

Dhaval Patel

Wednesday 19 August 2009 10:11:18 pm

hello,

Its ez functionality that when you go to the create mode, ez creates blank row into database and if you cancel then only it will delete the blank row.

With Best Regards,

Dhaval Patel
Team Leader - iNETProcess(I) Pvt. LTD.
dhaval.patel@inetprocess.com
Ph No: +91 79 65 12 35 00
http://www.inetprocess.co.in

John Smith

Thursday 20 August 2009 12:34:52 am

Sorry mate..

See below, it is bug in ezPublish. Make sure you check it as well in you installations.

http://ez.no/developer/forum/general/what_ok_button_doing_in_success_tpl_seems_bug#msg190987

I dont know how to get it sorted now. Any ideas?