Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
general-topic
Display users nickname and not displayname
Avatar
Gomlers
Member
Free Members
sp_UserOfflineSmall Offline
Apr 2, 2013 - 5:31 pm

Since I'm converting from phpbb, all my users are imported to wordpress, and their usernames - as they know them - has been made as wordpress nicknames.

Is there any way I can change this in either the functions-file or in the forum-settings, so that the users displayname is replaced by WP-nickname?

 

Image Enlarger

I need this to be WP Nickname

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Apr 2, 2013 - 5:39 pm

No, afraid not - at least without hacking core code...

why not just make the display name be the nickname??  this is the firs time anyone has requested such a thing...  also, users are not required to have a nickname so it could get dicey and problematic.  initially its the same as the display name...

I can make a note of this and consider adding that into the display options in the future...

Avatar
Gomlers
Member
Free Members
sp_UserOfflineSmall Offline
Apr 2, 2013 - 5:44 pm

You guys are so quick to respond :) I like that!

I heard you were on vacation Mr Papa, hope you had a nice trip! :)

I understand that this is a special request, and I'm sure I will work it our somehow.. But what did you mean by

why not just make the display name be the nickname??

I can do it and easiest way possible, so if you have anymore to say about how I can do that - please let me know.

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Apr 2, 2013 - 9:38 pm

well, I guess your import script is already done, right?  so you would need to right another short php script and run it once...

something like this:

global $wpdb;
$users = $wpdb->get_col("SELECT ID FROM $wpdb->users");
foreach ($users as $user) {
    $nickname = get_user_meta($user, 'nickname', $single);
    $wpdb->query("UPDATE $wpdb->users SET display_name='$nickname' WHERE ID=$user");
}

though I have not actually tested it...  but it grabs all the user ids, fetchs the nickname for each user and sets the display name to the nickname for each user id...

Avatar
Gomlers
Member
Free Members
sp_UserOfflineSmall Offline
Apr 3, 2013 - 12:54 pm

Thank you.

I tested your code on a testinstall, and it didn't work as expected.

All of the users got another option in the drop-down-list in WP-admin:

Normally, it says the username and display name in that field. And now, also "Array" :)

But thank you for your effort! :)

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Apr 3, 2013 - 2:18 pm

ah, said I hadnt tested it... ;)

change

    $nickname = get_user_meta($user, 'nickname', $single);

to

    $nickname = get_user_meta($user, 'nickname', true);

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 619
Members: 17362
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625