• I am using Ultimate Member on a membership site and I need a way for logged in users to be able to create a new user. Ultimate member doesn’t allow this by default (registration form is not displayed).

    I have re-created the registration form with Gravity forms so I can collect all of the required info, but not sure how to create a user programatically in the same way that UM does. I would like users created in this way to have the same metadata structure as the ones who come in through the UM registration form.

    Any help appreciated. Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @liquidonthedrums

    You can create a user with wp_create_user function. Once the user is created, you can now use the returned $user_id from the wp_create_user function to make additional meta values to the user. You can add a meta to a new user with the following code:

    
    update_user_meta( $user_id, "role", "subscriber" );
    update_user_meta( $user_id, "status", "activated" );
    
    

    Hope this works for you.

    Regards,

    Thread Starter liquidonthedrums

    (@liquidonthedrums)

    Thanks for the response @champsupertramp. Are any of the meta fields required for other functionality to work. eg. any of the UM actions in dropdown the admin/user screen, or the account self-management functionality for users.

    I can see that the standard registration form submits all of the entry values in a serialised array. This is stored with the ‘submitted’ meta key. Is this required?

    I am trying to stick as close to the default UM registration process in order to harness as much the in-built logic/workflow/functionality as I can, I just need a way for a logged in user to submit a registration form on behalf another user.

    Thanks for your time.

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @liquidonthedrums

    Submitted data is for your reference that can be found in the WP Admin > Users > see “View Info” when you hover on the list of users. That data is only added once but when a user modifies those data in the front-end profile, it won’t be updated since it is only a reference when they submit the data via Register form.

    Regards,

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Create User Programatically’ is closed to new replies.