Jump to content

PS 1.4.9 - User assignment in a group when registering


Recommended Posts

Currently in PS 1.4.9

I want that the user can choose from three groups:

-Private person
-Professional
-Student

The form offers me what I want, recording goes well until the end and saves my client unless it remains in the group by default 1.
The value of the radio input is not taken into account.

Someone could give me an opinion?

Thank you.



Changing the registration form authentication.tpl


in:

<fieldset class="account_creation">
<h3>{l s='Your personal information'}</h3>

add this:

<p class="radio required">
    <span>customer account</span>
    <input type="radio" name="id_default_group" id="id_default_group1" value="1" {if isset($smarty.post.id_default_group) && $smarty.post.id_default_group == '1'}checked="checked"{/if} />
    <label for="id_default_group1">Private person</label>
    <input type="radio" name="id_default_group" id="id_default_group2" value="2" {if isset($smarty.post.id_default_group) && $smarty.post.id_default_group == '2'}checked="checked"{/if} />
    <label for="id_default_group2">Professionnal</label>
    <input type="radio" name="id_default_group" id="id_default_group3" value="3" {if isset($smarty.post.id_default_group) && $smarty.post.id_default_group == '3'}checked="checked"{/if} />
    <label for="id_default_group3">Student</label>

</p>

Changing the AuthController.php file

under:

/* Preparing customer */
$customer = new Customer();

add this:

$Idgroupdef = $_POST['id_default_group'];

then under:

$customer->active = 1;

add:

if (!$customer->add(true,true,$Idgroupdef))

File change customer.php line 148

public function add($autodate = true, $nullValues = true, $Idgroupdef)

Link to comment
Share on other sites

  • 7 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...