use user 'name' as user nickname in profile

This topic contains 2 reply and 2 voices, and was last updated by towhid 9 years, 3 months ago
Viewing 2 Posts - 1 through 2 (of 2 total)
Author Posts
September 23, 2015 at 4:38 pm 72968
towhid hi currently, when a guest submits a form on my site, if they are not a user then wp frontend user registers them as a user - wonderful. At the moment the field 'name' on the form goes into display name in the user profile and the new 'user name' that the plugin creates, goes into Nickname How can I change the plugin files so that the 'Name' field that the user creates goes into Nickname in their profile - as opposed to their user name? Id also like to use the full email address as their user name too? Can anyone help?
September 23, 2015 at 7:06 pm 72992
Marc Peacock-Smith Marc Peacock-Smith

Ive managed to put their full name into nickname with wp_update_user( array(‘ID’ => $user_id, ‘nickname’ => $guest_name) );

But I cant work out how to use the full email address as username?

Currently when I log a new user my email address marc@myurl.com gets transformed to a user name of marc23 or some other random number. Even though my user doesnt exist as an active user.

September 30, 2015 at 2:58 pm 73532
towhid towhid

Hello Marc,

To use email as username please follow this steps:

Step 1: Please navigate to plugins/wp-user-frontend/class/render-form.php

Step 2: Find
$username = sanitize_user( substr( $email, 0, strpos( $email, '@' ) ) );

Step 3: Replace the following line over the previous line.
$username = $email;

Thanks

Viewing 2 Posts - 1 through 2 (of 2 total)