Home Forums Plugin Support WP User Frontend Pro Choose user type on registration

This topic is: resolved

This topic contains 16 replies, has 5 voices, and was last updated by  Nicolas 5 years, 6 months ago.

Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #2371

    noomia
    Participant
    Post count: 115

    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

    #2372

    Tareq Hasan
    Keymaster
    Post count: 2831

    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: < ?php echo do_shortcode( '[wpuf_profile type="profile" id="FORM_ID"]' ); ?>. 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.

    #2375

    ivaxtobac
    Participant
    Post count: 35

    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

    #2377

    Tareq Hasan
    Keymaster
    Post count: 2831

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

    #2379

    ivaxtobac
    Participant
    Post count: 35

    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

    #2380

    Tareq Hasan
    Keymaster
    Post count: 2831

    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.

    #2387

    ivaxtobac
    Participant
    Post count: 35

    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

    #2392

    Tareq Hasan
    Keymaster
    Post count: 2831

    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.

    #2402

    ivaxtobac
    Participant
    Post count: 35

    How can i use it on registration form?

    Thanks Tareq

    #2403

    Tareq Hasan
    Keymaster
    Post count: 2831

    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]

    #2430

    noomia
    Participant
    Post count: 115

    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
    #2456

    Tareq Hasan
    Keymaster
    Post count: 2831

    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.

    #2457

    noomia
    Participant
    Post count: 115

    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 ?

    #2458

    Tareq Hasan
    Keymaster
    Post count: 2831

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

    #5886

    mfragale
    Participant
    Post count: 1

    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?

Viewing 15 posts - 1 through 15 (of 17 total)

The topic ‘Choose user type on registration’ is closed to new replies.