Notifications
Clear all

Paid Addons Support Forum Only

Please note, that here we only support Paid Addons issues and questions.

gVectors Support staff works from 6am to 6pm (GMT+0)

All questions related to wpForo and wpDiscuz free plugins should be asked in the corresponding plugin support forum:

 

wpDiscuz Support Forum wpForo Support Forum

The email address is the username - how to force names?


Mary Mattiolo
Posts: 24
Customer
Topic starter
(@mary-mattiolo)
Member
Joined: 4 weeks ago

Hi, on my website, the e-mail addresses of the users are automatically stored as user names in my member area. It has to stay that way. Of course, the e-mail addresses can not be displayed publicly if someone is to be mentioned (data protection). But that's how it is at the moment. Can I set it to only show the NAME?

42 Replies
Astghik
Posts: 5354
Admin
(@astgh)
Support Team
Joined: 5 years ago

Hi Mary Mattiolo,

Please don't confuse Username and Nicename. Those are not the same. 

Nicenames are used for user @mentioning and in your profile URL. So again, this is the nicename, not username.

If you want to disable the wpDiscuz mentioning feature at all, you should disable the "User Mentioning" option. It's located in the Dashboard > wpDiscuz > Settings > Subscription and User Following admin page.

More info here:  https://wpdiscuz.com/docs/wpdiscuz-7/plugin-settings/subscription-and-user-following/#enable-user-mentioning

In any case, if you just want to hide the nicename, but allow people to @menation each other, you should put this code in WordPress active theme functions.php file. 

add_filter("wpdiscuz_show_nicename", "__return_false");

This article should be helpful for you:  https://www.wpbeginner.com/plugins/how-to-easily-add-custom-code-in-wordpress-without-breaking-your-site/

Important: The code above just hides the nicename next to the display name, but the mentioning feature will be still available if the users know the nicenames of each other. 

Reply
Mary Mattiolo
Posts: 24
Customer
Topic starter
(@mary-mattiolo)
Member
Joined: 4 weeks ago

Yes, that's all clear to me. However, when mentioned on my website, the e-mail addresses appear … 

Screenshots:

  1. ?dl=0
  2. ?dl=0
Reply
1 Reply
Astghik
Admin
(@astgh)
Joined: 5 years ago

Support Team
Posts: 5354

@mary-mattiolo,

The screenshots are missing, please attach those, to allow us to better understand the question. 

Reply
Mary Mattiolo
Posts: 24
Customer
Topic starter
(@mary-mattiolo)
Member
Joined: 4 weeks ago

The „preview icons“ are working when you click on it.

Reply
38 Replies
Mary Mattiolo
Customer
(@mary-mattiolo)
Joined: 4 weeks ago

Member
Posts: 24

@astgh Actually I cannot use this addon because the problem persists. Can you please help? 

Reply
Astghik
Admin
(@astgh)
Joined: 5 years ago

Support Team
Posts: 5354

Dear Mary Mattiolo,

As it is already mentioned, the wpDiscuz uses Nicename for mentioning. In your case, the mentioning Nicename and the Username are the same and those are email addresses. WordPress uses the same logic. 

The only thing we can suggest you is to update the Nicename and set it different than the username

UPDATE `wp_users` SET `user_nicename` = 'X' WHERE `user_nicename` = `user_email`

In the code above you should change the red marked value and set the Nicename as you like. 

The code will replace the Nicename where the Nicename is the email address of the users. 

Important: if you change the Nicename you should make sure it has the same validation as a user_login, otherwise the mentioning feature won't work.  

Reply
Mary Mattiolo
Customer
(@mary-mattiolo)
Joined: 4 weeks ago

Member
Posts: 24

@astgh Excuse me, but are you saying I should manually change each individual user, with the code? That would definitely not be feasible with so many users...?

Reply
Astghik
Admin
(@astgh)
Joined: 5 years ago

Support Team
Posts: 5354

@mary-mattiolo,

No, the code allows you to set the value for every user with email and nicename are the same, you can set it, for example, the user id or something else. You should decide for yourself what exactly it should be.

Reply
Mary Mattiolo
Customer
(@mary-mattiolo)
Joined: 4 weeks ago

Member
Posts: 24

@astgh I'm sorry but your explanations don't make any real sense. You write here: https://gvectors.com/forum/wpdiscuz-user-comment-mentioning/the-email-address-is-the-username-how-to-force-names/#post-32577

But my users don't have an email address in the URL. Instead - as you wrote and correctly - the NICENAME. 

Screenshot

Posted by: @astgh

Nicenames are used for user @mentioning and in your profile URL. So again, this is the nicename, not username.

Reply
Astghik
Admin
(@astgh)
Joined: 5 years ago

Support Team
Posts: 5354

Dear Mary Mattiolo,

Nicenames are used for user @mentioning and in your profile URL. So again, this is the nicename, not username.

This means, you don't have a plugin that has frontend profile plugin that uses the nicename in the profile URL. 

The solution provided will work fine: https://gvectors.com/forum/wpdiscuz-user-comment-mentioning/the-email-address-is-the-username-how-to-force-names/#post-32589

Reply
Mary Mattiolo
Customer
(@mary-mattiolo)
Joined: 4 weeks ago

Member
Posts: 24

@astgh OK. And what exactly has to be there instead of the red X? Can you give me the exact code there?

Reply
Astghik
Admin
(@astgh)
Joined: 5 years ago

Support Team
Posts: 5354

Dear Mary Mattiolo,

You should decide for yourself what exactly you need to use instead of the email.  You can use, for example, the user ID instead of the nicenames where it is the email address. 

Reply
Mary Mattiolo
Customer
(@mary-mattiolo)
Joined: 4 weeks ago

Member
Posts: 24

@astgh I'm aware … If I want to use the name, what value do I have to put in? Not the username, but the name of the respective person (see screenshot).

Reply
Astghik
Admin
(@astgh)
Joined: 5 years ago

Support Team
Posts: 5354

@mary-mattiolo,

The names can't be used as far as there is a space between two words. It's not allowed. Besides, the display name is not unique and can't be used as mentioning nicenames. 

Important: if you change the Nicename you should make sure it has the same validation as a user_login, otherwise the mentioning feature won't work.  

Reply
Mary Mattiolo
Customer
(@mary-mattiolo)
Joined: 4 weeks ago

Member
Posts: 24

@astgh As I explained before … I need the e-mail-addresses as user-names. I can't change them, otherwise my membership plugin won't work anymore because the e-mail-address is used for the login … so in this case, there is no solution to bring the mention feature to work on my site?

Reply
Astghik
Admin
(@astgh)
Joined: 5 years ago

Support Team
Posts: 5354

The code doesn't change the usernames it just replaces the nicenames. 

Reply
Mary Mattiolo
Customer
(@mary-mattiolo)
Joined: 4 weeks ago

Member
Posts: 24

@astgh Ok, so when I use the code to change the nicenames to the user ID, which value has to be instead of "X"?

UPDATE `wp_users` SET `user_nicename` = 'X' WHERE `user_nicename` = `user_email`
Reply
Astghik
Admin
(@astgh)
Joined: 5 years ago

Support Team
Posts: 5354

@mary-mattiolo,

The X should be replaced with the ID, that is: 

UPDATE `wp_users` SET `user_nicename` = 'ID' WHERE `user_nicename` = `user_email`

Please make a backup of your database before you do any operations.

Reply
Mary Mattiolo
Customer
(@mary-mattiolo)
Joined: 4 weeks ago

Member
Posts: 24

@astgh When I insert the exact following code

UPDATE 'wp_users' SET 'user_nicename' = 'ID' WHERE 'user_nicename' = 'user_email'

, I become the error: syntax error, unexpected single-quoted string "wp_users"

Reply
Astghik
Admin
(@astgh)
Joined: 5 years ago

Support Team
Posts: 5354

@mary-mattiolo,

try this one: 

UPDATE `wp_users` SET `user_nicename` = `ID` WHERE `user_nicename` = `user_email`
Reply
Mary Mattiolo
Customer
(@mary-mattiolo)
Joined: 4 weeks ago

Member
Posts: 24

@astgh then occurs the error: syntax error, unexpected token "`"

Reply
Astghik
Admin
(@astgh)
Joined: 5 years ago

Support Team
Posts: 5354

@mary-mattiolo,

Then remove the '`' symbol from the code. 

UPDATE wp_users SET user_nicename = ID WHERE user_nicename = user_email

 

Reply
Mary Mattiolo
Customer
(@mary-mattiolo)
Joined: 4 weeks ago

Member
Posts: 24

@astgh ehm, sorry, but do you think I'm dumb? I have exactly done whatever you told me to you with the codes you gave me. I copied them 1:1, and they don't work … When I remove the " ' " the same error as before occurs again … 

syntax error, unexpected identifier "wp_users"

The only reason, why I bought all! of your add-ons was, that this feature works.

Reply
Astghik
Admin
(@astgh)
Joined: 5 years ago

Support Team
Posts: 5354

@mary-mattiolo,

Please record some videos where we can see how you're adding the code. 

Reply
Mary Mattiolo
Customer
(@mary-mattiolo)
Joined: 4 weeks ago

Member
Posts: 24
Astghik
Admin
(@astgh)
Joined: 5 years ago

Support Team
Posts: 5354

@mary-mattiolo,

This is an SQL code. Please open phpMyAdmin Database manager of your hosting service > cPanel, navigate to WordPress database, press on SQL Tab and execute the query.

Helpful article: https://www.servercake.blog/run-sql-queries-using-phpmyadmin/

Don't forget about this. 

Please make a backup of your database before you do any operations.

Helpful article: https://backwpup.com/docs/wordpress-database-backup/

Reply
Mary Mattiolo
Customer
(@mary-mattiolo)
Joined: 4 weeks ago

Member
Posts: 24

@astgh omg … because of your post here: https://gvectors.com/forum/wpdiscuz-user-comment-mentioning/the-email-address-is-the-username-how-to-force-names/#post-32577

I thought this is just another snippet. 🤦‍♀️ 

Alright, then I know what to do. Just to be sure: Which of the three codes above should I use now. The first one?

UPDATE `wp_users` SET `user_nicename` = 'ID' WHERE `user_nicename` = `user_email`
Reply
Astghik
Admin
(@astgh)
Joined: 5 years ago

Support Team
Posts: 5354

@mary-mattiolo,

Yes, that one should be used. 

Reply
Mary Mattiolo
Customer
(@mary-mattiolo)
Joined: 4 weeks ago

Member
Posts: 24

@astgh Done, but the mail-addresses still show up …

Image 1

Image 2

Reply
Astghik
Admin
(@astgh)
Joined: 5 years ago

Support Team
Posts: 5354

@mary-mattiolo,

Could you please send the admin login details to info[at]gvectors.com email address? 

Reply
Mary Mattiolo
Customer
(@mary-mattiolo)
Joined: 4 weeks ago

Member
Posts: 24

@astgh Done 👍

Reply
Astghik
Admin
(@astgh)
Joined: 5 years ago

Support Team
Posts: 5354

@mary-mattiolo,

Thank you. Please wait a bit. I'll update this topic soon. 

Reply
Astghik
Admin
(@astgh)
Joined: 5 years ago

Support Team
Posts: 5354

@mary-mattiolo,

Please check it now. It should work fine. 

Reply
Mary Mattiolo
Customer
(@mary-mattiolo)
Joined: 4 weeks ago

Member
Posts: 24

@astgh 🍾 🍾 🍾 woohooo 🥳 Thank you very much! Can you please describe, what you have done and what the problem was?

Reply
Astghik
Admin
(@astgh)
Joined: 5 years ago

Support Team
Posts: 5354

@mary-mattiolo,

We've simply run the SQL code but made a few changes there. The Display Name is also needed to be updated.

Reply
Mary Mattiolo
Customer
(@mary-mattiolo)
Joined: 4 weeks ago

Member
Posts: 24

@astgh Thank you! For the future and new users, it will also work?

Reply
Mary Mattiolo
Customer
(@mary-mattiolo)
Joined: 4 weeks ago

Member
Posts: 24

@astgh hmm … I saw right now, that the mentioning not works for all users? Video

Reply
Astghik
Admin
(@astgh)
Joined: 5 years ago

Support Team
Posts: 5354

@mary-mattiolo,

For the future and new users, it will also work?

You should add the following PHP code in the active theme functions.php file:  

add_action('user_register', function($user_id) {
    $register_user = get_user_by('ID', $user_id);
    if($register_user->user_email == $register_user->display_name){
        wp_update_user(array(
            'ID' => $user_id,
            'user_nicename' => $user_id,
            'display_name' => $user_id
        ));
    }
});

I saw right now, that the mentioning not works for all users

We don't see such an issue on your website. Please watch this video:  https://www.screencast.com/t/qA7Cuw58

Please delete the browser caches before checking. 

Reply
Mary Mattiolo
Customer
(@mary-mattiolo)
Joined: 4 weeks ago

Member
Posts: 24

@astgh Okay, done with the functions.php

Please look here: Video

And here: Image

There is another Sonja in the user list. But she does not show up there … why?

Reply
Astghik
Admin
(@astgh)
Joined: 5 years ago

Support Team
Posts: 5354

@mary-mattiolo,

The user ID is set as a value of the nicename in the case the user has an email address as its value. So the current user isn't listed there. That is in the Database the user ID is set as a user nicename.

If you use the ID it'll be listed fine. 

Reply
Mary Mattiolo
Customer
(@mary-mattiolo)
Joined: 4 weeks ago

Member
Posts: 24

Sorry, but I don't understand what you mean. I thought the problem was solved now? I just want all users to be able to mark themselves (in compliance with data protection regulations) with their names ... in such a way that it will continue to work for everyone in the future, as new customers register regularly.

Reply
Astghik
Admin
(@astgh)
Joined: 5 years ago

Support Team
Posts: 5354

@mary-mattiolo,

The code we've provided you solves the problem you have. It replaces the user nicenames (where it sets the email addresses) with the user IDs. This works with the new users as well. If one of the newly registered users have the email address as a nicename it'll be replaced with the ID. 

Reply
Share:
Scroll to top