• Dear friends,
    I need to customize User creation in WP

    1. In current situation after user creation we need to check email and then login , but I need to login on same time to my account with that password (means redirect on same process itself).

    2. I need to remove some fields on user creation(like more info) and add some fields (like age,weight,height etc..)

    Please advise a method for same .

    Thanks,
    Anes

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    I don’t understand your first question. Is this for self-registration or when an admin adds a new user? Either way the password can be emailed to the user, validating the email address in the process. But what are you trying to do when you say:

    I need to login on same time to my account with that password (means redirect on same process itself)?

    To remove user profile fields, you need to enqueue an admin jQuery script that blanks the fields once the page loads. To add other fields, use the Settings API.

    Thread Starter anespa

    (@anespa)

    Dear bcworkz,
    In first point I mention is “Self-registration”. After registration ,
    I need to automatically redirect the user to his profile page without
    going a login page . Is it possible ? If so how . please let me know

    Thanks ,
    Anes

    Moderator bcworkz

    (@bcworkz)

    It is possible, but I’m much less sure it could be done safely. The reason the password is randomly generated and emailed to the registrant is it confirms the registrant provided a valid email address that they have control of. This cannot be done unless a login is presented to confirm they received and read the email sent.

    In order to go straight to the profile page, you would need to auto-login a new registrant, meaning anyone could register with bogus credentials, so there is really no point in registering at all.

    You must present a login page to new registrants. It validates the email address and gets them to select their own password after the random one is used.

    The default behavior after the login page is to offer the dashboard page. It is possible to change this to a different page if that helps any, but the intervening login page is really a necessity.

    To go to the profile page instead of dashboard, you could hook into the ‘login_redirect’ filter and supply a different URL. This would apply to all users unless you use a conditional structure to apply it only to users of certain capabilities or lack of.

    Or you could change the link in the sent email to that of the profile page. The login page will still be presented first. This is done by re-defining the pluggable function wp_new_user_notification(). The original source code is in wp-includes/pluggable.php.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to customize user creation’ is closed to new replies.