The effects of alcohol on sustanon 250 leucine for – real weight loss & bodybuilding benefits?
Search
Close
AI Search
Classic Search
 Search Phrase:
 Search Type:
Advanced search options
 Search in Forums:
 Search in date period:

 Sort Search Results by:

AI Assistant
How can I change su...
 
Share:
Notifications
Clear all

Question [Solved] How can I change subscribers name to full name?

2 Posts
2 Users
0 Reactions
563 Views
Posts: 1
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@herby65)
New Member
Joined: 11 months ago
[#9655]

Our website uses the comment function exclusively in the members area.

When someone makes a comment, I would like to see the full name. Often the users have abbreviations that make it difficult to immediately identify who they are. I have already tried various methods, but none of them work.
The subscriber name (or author name) should be replaced by First / Lastname.

I had the script developed, but it works.

Maybe it is much simpler.
Where can I find the code to swap the names?
Who can help?

 

document.addEventListener('DOMContentLoaded', function () {
    // Warte, bis die Seite vollständig geladen ist
    var commentAuthors = document.querySelectorAll('#wpdcom .wpd-comment-header .wpd-comment-author');

    commentAuthors.forEach(function(authorElement) {
        var userId = authorElement.getAttribute('data-user-id'); // Benutzer-ID holen
        if (userId) {
            // Benutzerdaten abrufen (Vorname, Nachname)
            fetch('/wp-json/wp/v2/users/' + userId)
                .then(response => response.json())
                .then(user => {
                    var firstName = user.first_name;
                    var lastName = user.last_name;
                    var fullName = firstName + ' ' + lastName;
                    
                    // Den Kommentatorennamen ersetzen
                    authorElement.textContent = fullName; 
                })
                .catch(error => console.error('Fehler beim Abrufen des Benutzernamens:', error));
        }
    });
});

1 Reply
Asti
Posts: 8208
 Asti
Support
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@asti)
Illustrious Member
Joined: 8 years ago

Hi,

You should change the "Display name publicly as" option value. The following article should help you with this: https://memberfix.rocks/change-display-name-publicly-as/


Reply
Share: