The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Display Name

View previous topic View next topic Go down

Display Name

Post by mybubulov3 on June 20th 2013, 8:00 am

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
New Member

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

Back to top Go down

Re: Display Name

Post by Ultron's Vision on June 20th 2013, 8:30 am

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
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

Re: Display Name

Post by tommycoo on June 20th 2013, 8:37 am

is this really can happen with jquery ?
cool

tommycoo
Forumember

Male Posts : 615
Reputation : 9
Language : Indonesia

http://www.atlanta.forumid.net

Back to top Go down

Re: Display Name

Post by Ultron's Vision on June 20th 2013, 9:08 am

Indeed, it is possible.

I will wait for the original poster to comment on this before I post the script.

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

Re: Display Name

Post by tommycoo on June 20th 2013, 9:22 am

oke then Smile
for punbb version to yeah ? Razz

tommycoo
Forumember

Male Posts : 615
Reputation : 9
Language : Indonesia

http://www.atlanta.forumid.net

Back to top Go down

Re: Display Name

Post by mybubulov3 on June 20th 2013, 9:44 am

@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
New Member

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

Back to top Go down

Re: Display Name

Post by Ultron's Vision on June 20th 2013, 10:17 am

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
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

Re: Display Name

Post by mybubulov3 on June 20th 2013, 10:23 am

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
New Member

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

Back to top Go down

Re: Display Name

Post by Ultron's Vision on June 20th 2013, 10:28 am

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
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

Re: Display Name

Post by mybubulov3 on June 20th 2013, 10:39 am

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
New Member

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

Back to top Go down

Re: Display Name

Post by Ultron's Vision on June 20th 2013, 10:57 am

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
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

Re: Display Name

Post by mybubulov3 on June 20th 2013, 12:42 pm

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
New Member

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

Back to top Go down

Re: Display Name

Post by Ultron's Vision on June 20th 2013, 1:19 pm

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
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

Re: Display Name

Post by mybubulov3 on June 20th 2013, 1:23 pm

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
New Member

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

Back to top Go down

Re: Display Name

Post by Ultron's Vision on June 20th 2013, 2:21 pm

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
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

Re: Display Name

Post by mybubulov3 on June 20th 2013, 2:37 pm

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
New Member

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

Back to top Go down

Re: Display Name

Post by mybubulov3 on June 21st 2013, 6:31 am

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
New Member

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

Back to top Go down

Re: Display Name

Post by SLGray on June 21st 2013, 6:34 am

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!


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


SLGray
Administrator
Administrator

Male Posts : 35627
Reputation : 2372
Language : English
Location : United States

http://fmthemes.forumotion.com/

Back to top Go down

Re: Display Name

Post by Ultron's Vision on June 21st 2013, 1:34 pm

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
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

Re: Display Name

Post by mybubulov3 on June 21st 2013, 4:25 pm

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

mybubulov3
New Member

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

Back to top Go down

Re: Display Name

Post by Ultron's Vision on June 25th 2013, 1:41 pm

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
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

Re: Display Name

Post by Guest on June 25th 2013, 1:46 pm

Solved and no spamming like Grey said please

Guest
Guest


Back to top Go down

Re: Display Name

Post by Ultron's Vision on June 25th 2013, 2:01 pm

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
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

Re: Display Name

Post by Guest on June 25th 2013, 2:09 pm

@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

Guest
Guest


Back to top Go down

Re: Display Name

Post by Ultron's Vision on June 25th 2013, 2:33 pm

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
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

Re: Display Name

Post by SLGray on June 25th 2013, 6:43 pm

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


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


SLGray
Administrator
Administrator

Male Posts : 35627
Reputation : 2372
Language : English
Location : United States

http://fmthemes.forumotion.com/

Back to top Go down

Re: Display Name

Post by mybubulov3 on June 26th 2013, 3:43 am

@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
New Member

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

Back to top Go down

Re: Display Name

Post by Ultron's Vision on June 26th 2013, 2:30 pm

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
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

Re: Display Name

Post by mybubulov3 on June 26th 2013, 4:11 pm

OK, whenever you have time Very Happy.

mybubulov3
New Member

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

Back to top Go down

View previous topic View next topic Back to top


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