The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Display Name

4 posters

Go down

Display Name Empty Display Name

Post by mybubulov3 20/6/2013, 09:00

Hi there,

Is there any way to make display name different from username? For example, I want to display the users' full names rather than their usernames, which are hard to recognize. It should be something like this forum: http://www.hn-ams.org/forum/, just go to the register section and you will see (sorry, this is in Vietnamese and powered by vB, just an example).

Moreover, if you could make the usernames become something like the Facebook's alternative names, that would be very much appreciated Very Happy.
mybubulov3
mybubulov3
New Member

Male Posts : 12
Reputation : 1
Language : Vietnamese | English | French
Location : Ho Chi Minh City, Vietnam

Back to top Go down

Display Name Empty Re: Display Name

Post by Ultron's Vision 20/6/2013, 09:30

You can use jQuery to change the display name everywhere but in the chatbox and on profile pages, if that is what you want.
Ultron's Vision
Ultron's Vision
Forumember

Male Posts : 634
Reputation : 45
Language : English | German | HTML | JavaScript | PHP | C++ | Perl | Java
Location : Vienna, Austria

http://duelacademy.net

Back to top Go down

Display Name Empty Re: Display Name

Post by tommycoo 20/6/2013, 09:37

is this really can happen with jquery ?
cool
tommycoo
tommycoo
Forumember

Male Posts : 615
Reputation : 9
Language : Indonesia

http://www.atlanta.forumid.net

Back to top Go down

Display Name Empty Re: Display Name

Post by Ultron's Vision 20/6/2013, 10:08

Indeed, it is possible.

I will wait for the original poster to comment on this before I post the script.
Ultron's Vision
Ultron's Vision
Forumember

Male Posts : 634
Reputation : 45
Language : English | German | HTML | JavaScript | PHP | C++ | Perl | Java
Location : Vienna, Austria

http://duelacademy.net

Back to top Go down

Display Name Empty Re: Display Name

Post by tommycoo 20/6/2013, 10:22

oke then Smile
for punbb version to yeah ? Razz
tommycoo
tommycoo
Forumember

Male Posts : 615
Reputation : 9
Language : Indonesia

http://www.atlanta.forumid.net

Back to top Go down

Display Name Empty Re: Display Name

Post by mybubulov3 20/6/2013, 10:44

Ultron's Vision wrote:You can use jQuery to change the display name everywhere but in the chatbox and on profile pages, if that is what you want.

That is exactly what I want Very Happy. However, the problem is that I don't know what jQuery is :|. Is it something like CSS? Does it mean that we can use either jQuery or CSS to solve this problem?

Oh and mine is phpBB3, but, in case I may change the version in the future, what is the difference between those versions (in terms of the coding, CSS, jQuery, etc.)?

Thank you Very Happy.
mybubulov3
mybubulov3
New Member

Male Posts : 12
Reputation : 1
Language : Vietnamese | English | French
Location : Ho Chi Minh City, Vietnam

Back to top Go down

Display Name Empty Re: Display Name

Post by Ultron's Vision 20/6/2013, 11:17

There shouldn't be a difference between the two phpBB versions...

jQuery is a JavaScript framework. Add the code below under Admin Panel -> Modules -> HTML & JavaScript -> JavaScript pages management -> Create new and select 'In all the pages'.

Code:
jQuery(document).ready(function(){

var newName = '<span><strong>New Name here</strong></span>';

jQuery('a[href="/u1"] span').html(newName);
jQuery('a[title="Old Username"]').html(newName);

});

You need to replace /u1 with the appropriate number for each user, and replace Old Username with the username of the user you want to change.
Note that you shouldn't use too many names there, it might cause the page to load slower.
Ultron's Vision
Ultron's Vision
Forumember

Male Posts : 634
Reputation : 45
Language : English | German | HTML | JavaScript | PHP | C++ | Perl | Java
Location : Vienna, Austria

http://duelacademy.net

Back to top Go down

Display Name Empty Re: Display Name

Post by mybubulov3 20/6/2013, 11:23

So, is there any difference between phpBBs and punBB or IPB?

It seems like I can't get you. Where can I get the "appropriate number for each user"? Is it User ID or something? Btw, actually I want to make this change for all users; this means every user's display name will be changed, not only some users' only. Or did I misunderstand you?
mybubulov3
mybubulov3
New Member

Male Posts : 12
Reputation : 1
Language : Vietnamese | English | French
Location : Ho Chi Minh City, Vietnam

Back to top Go down

Display Name Empty Re: Display Name

Post by Ultron's Vision 20/6/2013, 11:28

Ah, you're referring to IPB's display name change, I know.

You are using a forumotion forum, right? Each user can be accessed by a certain User ID, yes, mine is /u82318 in here, for example.
So I would change a[href="/u1"] span to a[href="/u82318"] span and a[title="Old Username"] to a[title="Ultron\'s Vision"].

There is a difference between each of these forums, yes.
Ultron's Vision
Ultron's Vision
Forumember

Male Posts : 634
Reputation : 45
Language : English | German | HTML | JavaScript | PHP | C++ | Perl | Java
Location : Vienna, Austria

http://duelacademy.net

Back to top Go down

Display Name Empty Re: Display Name

Post by mybubulov3 20/6/2013, 11:39

I just tested the code in my Test Forum and it really worked! Since my forums current just have 2 members, I just let it be "u1" LOL. However, the problem is that if I want to change the display name or every user, will I have to create a code for each user?

One of my efforts: I created a field named "Full name" and make it required in registration. Now, is there any way for me to redirect the "new name" in your code to my field "full name"?

Oh and IPB offered display name change feature? That would be cool!
mybubulov3
mybubulov3
New Member

Male Posts : 12
Reputation : 1
Language : Vietnamese | English | French
Location : Ho Chi Minh City, Vietnam

Back to top Go down

Display Name Empty Re: Display Name

Post by Ultron's Vision 20/6/2013, 11:57

Well, yes, it would be possible to do so within topics, but outside topics, not really.
You can use the script I gave you for quite some usernames, yes, but be sure to find the right number of usernames so that you forum does not lag.

And IPB is paid forum software so you can expect it to have quite some features forumotion does not have. But that aside.
Ultron's Vision
Ultron's Vision
Forumember

Male Posts : 634
Reputation : 45
Language : English | German | HTML | JavaScript | PHP | C++ | Perl | Java
Location : Vienna, Austria

http://duelacademy.net

Back to top Go down

Display Name Empty Re: Display Name

Post by mybubulov3 20/6/2013, 13:42

Sorry, what do you mean by "inside / outside the topics", does it mean the changes only apply inside the threads?

Yes, I could do that for many usernames manually, but is there a way, I mean automatic way, to do that, such as let users fill in a field named "Full name", for example, when they register, and then automatically make that field their display names?
mybubulov3
mybubulov3
New Member

Male Posts : 12
Reputation : 1
Language : Vietnamese | English | French
Location : Ho Chi Minh City, Vietnam

Back to top Go down

Display Name Empty Re: Display Name

Post by Ultron's Vision 20/6/2013, 14:19

Inside topics I can query the content of the Full Name field, outside of topics the field doesn't exist (well, it does exist in profiles, but that aside) so I wouldn't be able to access it there, sorry.
Ultron's Vision
Ultron's Vision
Forumember

Male Posts : 634
Reputation : 45
Language : English | German | HTML | JavaScript | PHP | C++ | Perl | Java
Location : Vienna, Austria

http://duelacademy.net

Back to top Go down

Display Name Empty Re: Display Name

Post by mybubulov3 20/6/2013, 14:23

Well, it would still be OK if you can handle it just inside topics Very Happy. So what do I have to change in your code Very Happy?

Nevertheless, if the field exists in profiles, could you use it to replace the usernames outside the topics? Very Happy
mybubulov3
mybubulov3
New Member

Male Posts : 12
Reputation : 1
Language : Vietnamese | English | French
Location : Ho Chi Minh City, Vietnam

Back to top Go down

Display Name Empty Re: Display Name

Post by Ultron's Vision 20/6/2013, 15:21

Well, I could try.

I would need a link to your forum for testing purposes, though, and an admin account to test the script would be great, too.

You can do so via PM, if you decide to provide me an admin account, do not ever post it publicly.
Ultron's Vision
Ultron's Vision
Forumember

Male Posts : 634
Reputation : 45
Language : English | German | HTML | JavaScript | PHP | C++ | Perl | Java
Location : Vienna, Austria

http://duelacademy.net

Back to top Go down

Display Name Empty Re: Display Name

Post by mybubulov3 20/6/2013, 15:37

Well basically my forum is just like every new forum you can create, so testing in my forum or in your test forum is just the same. Moreover, my forum is in Vietnamese, so it will probably be difficult for you to understand... However, if you really need to test it in my forum, just let me know, via either post here or pm Wink.

Mine is phpBB3, btw Very Happy.
mybubulov3
mybubulov3
New Member

Male Posts : 12
Reputation : 1
Language : Vietnamese | English | French
Location : Ho Chi Minh City, Vietnam

Back to top Go down

Display Name Empty Re: Display Name

Post by mybubulov3 21/6/2013, 07:31

BUMP. Where are you Ultron's Vision, or everybody else...
Just say sth if you're still there, or are you all sleeping? Very Happy.
mybubulov3
mybubulov3
New Member

Male Posts : 12
Reputation : 1
Language : Vietnamese | English | French
Location : Ho Chi Minh City, Vietnam

Back to top Go down

Display Name Empty Re: Display Name

Post by SLGray 21/6/2013, 07:34

Please don't double/triple post. Your post need to be separated by 24 hours before bumping, replying or adding more information. Please use the edit button instead!


Display Name Slgray10

When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51489
Reputation : 3519
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Display Name Empty Re: Display Name

Post by Ultron's Vision 21/6/2013, 14:34

Thing is, I need some time, as I won't be home much today and that tomorrow I got some work to do for a while, so you can expect me to be done with it on Sunday maybe...

Sorry for the inconvenience.
Ultron's Vision
Ultron's Vision
Forumember

Male Posts : 634
Reputation : 45
Language : English | German | HTML | JavaScript | PHP | C++ | Perl | Java
Location : Vienna, Austria

http://duelacademy.net

Back to top Go down

Display Name Empty Re: Display Name

Post by mybubulov3 21/6/2013, 17:25

No problem, Ultron's Vision; I'm in the same situation LOL, flooded by homework X_X. See you Sunday Wink.
mybubulov3
mybubulov3
New Member

Male Posts : 12
Reputation : 1
Language : Vietnamese | English | French
Location : Ho Chi Minh City, Vietnam

Back to top Go down

Display Name Empty Re: Display Name

Post by Ultron's Vision 25/6/2013, 14:41

Okay, I have some code ready, but this implies that you have the profile field "Display Name" set as 1st profile field (otherwise, you must change a number in the code below).

Code:
jQuery(document).ready(function(){

var pp = document.getElementsByClassName("postbody");

for(var i = 0; i < pp.length; i++) {

var dispName = pp[i].getElementsByTagName("dd")[2].getElementsByClassName("label")[0].nextSibling;
/* You need to replace 0 with the number of the profile field number you have set for the display name profile field minus 1; arrays start counting at 0, not at 1, so the first element is [0], not [1], [1] is the second element. If you need help with this, post here. */
// now a long, long line

pp[i].getElementsByTagName("dl")[0].getElementsByTagName("dt")[0].getElementsByTagName("strong")[0].getElementsByTagName("a")[0].getElementsByTagName("span")[0].getElementsByTagName("strong")[0].innerHTML = dispName;

}

});

Tested in phpBB 3 and my console, should work.
Ultron's Vision
Ultron's Vision
Forumember

Male Posts : 634
Reputation : 45
Language : English | German | HTML | JavaScript | PHP | C++ | Perl | Java
Location : Vienna, Austria

http://duelacademy.net

Back to top Go down

Display Name Empty Re: Display Name

Post by Guest 25/6/2013, 14:46

Solved and no spamming like Grey said please
avatar
Guest
Guest


Back to top Go down

Display Name Empty Re: Display Name

Post by Ultron's Vision 25/6/2013, 15:01

RikudouSennin wrote:Solved and no spamming like Grey said please

Please, do wait for the original poster to mark this as solved.

Also, I think SLGray did already made that clear, no need for you to repeat it.
Ultron's Vision
Ultron's Vision
Forumember

Male Posts : 634
Reputation : 45
Language : English | German | HTML | JavaScript | PHP | C++ | Perl | Java
Location : Vienna, Austria

http://duelacademy.net

Back to top Go down

Display Name Empty Re: Display Name

Post by Guest 25/6/2013, 15:09

Ultron's Vision wrote:
RikudouSennin wrote:Solved and no spamming like Grey said please

Please, do wait for the original poster to mark this as solved.

Also, I think SLGray did already made that clear, no need for you to repeat it.
sir I was merely helping beccause he repeated himself twice and plus other users say solved so do i
avatar
Guest
Guest


Back to top Go down

Display Name Empty Re: Display Name

Post by Ultron's Vision 25/6/2013, 15:33

I do not wish to get into an argument now - I'm merely mentioning that I would appreciate for you to wait until the original poster has marked this as solved.
Also, if you follow the messages in this topic, you get to see that SLGray posted only once, so there is - as I mentioned above - no need for you to repeat it, the original poster has seen it.
Ultron's Vision
Ultron's Vision
Forumember

Male Posts : 634
Reputation : 45
Language : English | German | HTML | JavaScript | PHP | C++ | Perl | Java
Location : Vienna, Austria

http://duelacademy.net

Back to top Go down

Display Name Empty Re: Display Name

Post by SLGray 25/6/2013, 19:43

RikudouSennin wrote:Solved and no spamming like Grey said please
Please refrain from moderating members, this is a staff job.


Display Name Slgray10

When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51489
Reputation : 3519
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Display Name Empty Re: Display Name

Post by mybubulov3 26/6/2013, 04:43

Ultron's Vision wrote:Okay, I have some code ready, but this implies that you have the profile field "Display Name" set as 1st profile field (otherwise, you must change a number in the code below).

Code:
jQuery(document).ready(function(){

var pp = document.getElementsByClassName("postbody");

for(var i = 0; i < pp.length; i++) {

var dispName = pp[i].getElementsByTagName("dd")[2].getElementsByClassName("label")[0].nextSibling;
/* You need to replace 0 with the number of the profile field number you have set for the display name profile field minus 1; arrays start counting at 0, not at 1, so the first element is [0], not [1], [1] is the second element. If you need help with this, post here. */
// now a long, long line

pp[i].getElementsByTagName("dl")[0].getElementsByTagName("dt")[0].getElementsByTagName("strong")[0].getElementsByTagName("a")[0].getElementsByTagName("span")[0].getElementsByTagName("strong")[0].innerHTML = dispName;

}

});

Tested in phpBB 3 and my console, should work.
...I'm afraid that this does not work in my 2 forums Sad. Note that I already had a field named "Display Name" set as the first profile field, and I already enabled the JavaScript. Maybe you should test it yourself in my forum (because I probably did something wrong...), I will PM you Very Happy.
mybubulov3
mybubulov3
New Member

Male Posts : 12
Reputation : 1
Language : Vietnamese | English | French
Location : Ho Chi Minh City, Vietnam

Back to top Go down

Display Name Empty Re: Display Name

Post by Ultron's Vision 26/6/2013, 15:30

I shall have a look at it today or tomorrow (now that school is over for this year, I will definitely have more time).
Ultron's Vision
Ultron's Vision
Forumember

Male Posts : 634
Reputation : 45
Language : English | German | HTML | JavaScript | PHP | C++ | Perl | Java
Location : Vienna, Austria

http://duelacademy.net

Back to top Go down

Display Name Empty Re: Display Name

Post by mybubulov3 26/6/2013, 17:11

OK, whenever you have time Very Happy.
mybubulov3
mybubulov3
New Member

Male Posts : 12
Reputation : 1
Language : Vietnamese | English | French
Location : Ho Chi Minh City, Vietnam

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum