Support » Plugin: WPAdverts - Classifieds Plugin » Authors register: users’ login and display name

  • Resolved Matt Biscay

    (@skyminds)


    Hi Greg,

    It looks like users are created with emails as their login (and their display name if a filtered version of the email address). This does not play nice with WPDiscuz user mentioning addon as it shows the commenter’s email in plain sight when you mention them.

    Is there a way we can choose another field than email to create/update users when they register? We have the Authors and Custom Fields addons so we can add a username field if needs be.

    Thank you,
    Matt

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Matt Biscay

    (@skyminds)

    Hi Greg,

    Is there a way we can force user_publicname to be unique? This could actually kill two birds with one stone and solve the issue above as well.

    Thank you,
    Matt

    Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    hmm right now we do not have any filter/action in the Authors which would allow changing the public name in the registered user, but since the Authors is using wp_create_user() to register a new user you can use a wp_pre_insert_user_data filter to change some params before the user will be registered.

    
    add_filter( "wp_pre_insert_user_data", function( $data, $update, $ID ) {
      if( isset( $_POST["_adverts_action"] ) && $_POST["_adverts_action"] == "author_register" ) {
        // make changes to $data variable
      } 
      return $data;
    }, 10, 3 );
    

    What is in the $data variable you can see here https://developer.wordpress.org/reference/hooks/wp_pre_insert_user_data/

    Thread Starter Matt Biscay

    (@skyminds)

    Hi Greg,

    Thank you very much!

    Best,
    Matt

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Authors register: users’ login and display name’ is closed to new replies.