Events Made Easy Forums How do I … How can I change what EME uses to set WP user name

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #64825
    Anonymous
    Inactive

    I think my solution would be similar to, but I am at a loss for how to modify and apply:
    https://www.e-dynamics.be/wordpress/forums/topic/how-modify-eme_create_user-function/

    I have looked through settings and I cannot find where EME uses the first and last name of an RSVP set to create new users, I would like this to be set from a custom field for nickname or username.
    I do not currently have a separate system for creating WP users but that is an option for me also, just makes new users being a 2 step process for events.

    PS. so far as I take each step through testing this, EME is working out to be a very complete system with great functions. I hope when I’m done configuring everything it will be the last event software I test.

    #64826
    Franky
    Keymaster

    It is in fact EME that creates a username based on firstname/lastname (also like wp does).
    But in the thread you mention, you see an example:

    
    add_filter('eme_wp_userdata_filter','eme_my_wp_userdata_function');
    function eme_my_wp_userdata_function($person){
       $userdata=array();
       $userdata['display_name']=$person['firstname'].' '.substr($person['lastname'],0,1);
       return $userdata;
    }
    

    To change the username you’d need to set $userdata[‘user_login’], but in the current EME version that’s being ignored and overwritten by the EME generated username. This fixes it (only the change in eme-functions.php is needed):

    https://github.com/liedekef/events-made-easy/commit/da2b7af0539ca676c821e6eeaf42fcf448b79a6a

    #64830
    Anonymous
    Inactive

    Franky,
    Thank you for the quick reply. I have scrolled through many of the other documentation files. One thing I cannot find is an example using Custom Fields except for one example with event headers. Is this possible to do with other hooks and filters?

    I have a form that uses #_FILED{username} and I would like to use that input to create the WordPress Username. Username is a custom people field.

    #64834
    Franky
    Keymaster

    Once you have $person (in your filter), you can get the people-fields using something like:

    $answers = eme_get_person_answers($person[‘person_id’]);

    When you do a print_r on that, you’ll see the info 🙂
    But just using the user input as username might not be ok. You can call the eme function eme_generate_unique_wp_username to assist in getting a good username. However, first apply https://github.com/liedekef/events-made-easy/commit/36309053be2f7e40335d89417b9fe763e46c78ce then 🙂

    Btw: do read this post: https://www.e-dynamics.be/wordpress/forums/topic/security-release/

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘How do I …’ is closed to new topics and replies.
Scroll to Top