Choose user type on registration

This topic contains 16 reply and 5 voices, and was last updated by Nicolas 10 years, 4 months ago
Viewing 15 Posts - 1 through 15 (of 16 total)
Author Posts
April 17, 2013 at 3:22 pm 2371
Nicolas Hi Tareq ! First of all, thank you for you great plugin. Here's what I wanna do : Have a registration page with just these fields : Email (which is the username too), Password, User type (subscriber/editor,...). Once the user is registered, the user can access the edit profile page, where he has the other fields. But these fields are not the same for editor or for subscriber role. So how could I achieve that ? Create one form for Subscriber and an other one for Editor ? And what about the quick register page (3 fields) and the complete edit profile page (a lot more fields) ?   Thanks a lot :) Noomia
April 17, 2013 at 3:35 pm 2372
Tareq Hasan Tareq Hasan

Here’s how I would do, create two forms for user registration with those simple fields (don’t forget to select the user role for registration). Then I would insert them in a page in two tabs (Subscriber and Editor).

Now as two different type of forms needed for editing those user profiles, I would create another two forms. Then, if I am able to change codes in theme, I would create a page template and will add a simple logic to determine the current user level and show the suitable form with the shortcode: . If I am not going to make trouble editing the theme, then the solution would be inserting those two shortcode in two pages and add a link to those edit profile pages based on user role.

April 17, 2013 at 4:40 pm 2375
ivaxtobac ivaxtobac

Sorry for make a question here, but it is relavant

How to make a dropbox on registration to give oportunity at users to choose what role want?

Thanks

April 17, 2013 at 4:58 pm 2377
Tareq Hasan Tareq Hasan

Adding any dropbox will not be picked up in registration process, so it’ll not help.

April 17, 2013 at 5:15 pm 2379
ivaxtobac ivaxtobac

I don’t understand

I want that users can choose on registration what role have after on site (suscriptor, editor, etc.).  What can i do?

Thanks

April 17, 2013 at 5:20 pm 2380
Tareq Hasan Tareq Hasan

Do what I suggested to Noomia, create different registration forms for each role and add them in the page in a tabbed area. So you’ll have different registration form in each tab.

April 17, 2013 at 6:49 pm 2387
ivaxtobac ivaxtobac

But it’s not a good option for me. On registration form i have 3 fields (name, password, and country) Only dropbox for roles it’s different. Make two registrations forms it’s not “professional” in my case

Any solution?

Thanks

April 17, 2013 at 10:01 pm 2392
Tareq Hasan Tareq Hasan

I’ve just pushed a version `2.1.3`. A new filter has been added `wpuf_register_user_args`. With this filter, you will be able to change the user role dynamically when a user registers.

April 17, 2013 at 11:40 pm 2402
ivaxtobac ivaxtobac

How can i use it on registration form?

Thanks Tareq

April 17, 2013 at 11:46 pm 2403
Tareq Hasan Tareq Hasan

May be use a radio or dropdown to select the role and use the filter like this:

[php]
function wpufe_my_switch_reg( $args ) {
if ( $_POST[‘role’] == ‘Editor’ ) {
$args[‘role’] = ‘editor’;
} elseif ( $_POST[‘role’] == ‘somethings_else’ ) {
$args[‘role’] = ‘subscriber’;
}

return $args;
}

add_filter( ‘wpuf_register_user_args’, ‘wpufe_my_switch_reg’ );
[/php]

April 18, 2013 at 8:05 am 2430
noomia noomia

So thanks to that, I can do 3 different register forms to achieve what I want :

1. A small one with Email, Password and Role selection.

2. A big one for Subscribers

3. A big one for Editors

Is that right ?

Is it possible to have just the Email field and that the Username take the Email field value ?

 

I have another question, not related : in “General Options”, what is the aim of the field :

Edit Page  Select the page where [wpuf_edit] is located
April 18, 2013 at 12:47 pm 2456
Tareq Hasan Tareq Hasan

Yes, you can only use the email field. Username will be taken from the email address, if it’s already in use, it’ll add some random number to that username.

Edit Page is needed for editing a post in frontend.

April 18, 2013 at 12:55 pm 2457
noomia noomia

Edit Page is needed for editing a post in frontend.

Ok but I have 4 custom post types and want 1 edit page for each… So wich one do I have to enter there ?

April 18, 2013 at 1:00 pm 2458
Tareq Hasan Tareq Hasan

You just need one edit page with that shortcode, not 4. It’ll handle all those forms.

July 11, 2013 at 10:39 pm 5886
mfragale mfragale

Tried to use this function, but it didn’t work.

function wpufe_my_switch_reg( $args ) {
    if ( $_POST['role'] == 'Editor' ) {
        $args['role'] = 'editor';
    } elseif ( $_POST['role'] == 'somethings_else' ) {
        $args['role'] = 'subscriber';
    }
 
    return $args;
}
 
add_filter( 'wpuf_register_user_args', 'wpufe_my_switch_reg' );

I made a registration form with a dropdown menu with the Meta Key = role.

What am I missing here?

July 12, 2013 at 1:44 am 5891
Tareq Hasan Tareq Hasan

There is already a hidden field named role in the form, so choose a different custom field name.

Viewing 15 Posts - 1 through 15 (of 16 total)