File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JForum and the fly likes Display name Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JForum
Bookmark "Display name" Watch "Display name" New topic
Author

Display name

Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
The author of the post is displayed as the same of the login ID, in some cases the login ID is a number or anything that is not expressive, it's better to have a displayname...is that available in JForum?

If yes...can that name be mapped to LDAP property such as (displayname)?
Thank you.

[originally posted on jforum.net by Silver33]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
The easiest way I found to do this is to modifying the templates to use the user.from property. This is generally set to the concatenation of the firstname and lastname properties.

As to LDAP... Without doing code modification, you are limited to the objects (like the user object) that jforum puts into the template context. These are populated from jForum's database tables.

So, if you are authenticating against LDAP, you will need to be sure that your SSO implimentation always sets the first and last name fields in the jforum_users table.
[originally posted on jforum.net by monroe]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Thank you for replying...but I still need more help ...maybe you can explain more...
I'm using Jforum in iFrame portlet,and I'm using cookie SSO...I set the Login ID from the portlet and retrive it in Jforum SSO class....can you give me more detailed steps to change the display name?

Thank you in advance
[originally posted on jforum.net by Silver33]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
You can check this Display the name of JForum's user as his real name instead of his username(login ID) for a guideline.
[originally posted on jforum.net by andowson]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Thank you very much...
it's a great job and you have saved me a lot if I would start it from scratch....

I think It would be great if the option to use a display name instead of the login name is added to Jform in the next version.
[originally posted on jforum.net by Silver33]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Just for the record... a shorter, no code change, but not as complete way is to just change .userName to .from in the templates Andowson lists. This may not work for all languages but it worked fine for my US/Western EU centric forums...

Also, it's generally better to make a copy of the default directory in the templates directory. Make your changes there. Then change the templates.directory config property to point to the modified version. Makes upgrading jForum and figuring out template differences easier.


[originally posted on jforum.net by monroe]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
I changed authenticator of JForum to LDAP, which works well and as expected. There is only one problem, username is e-mail address of user, because LDAP structure was designed for a e-mail service, so uid contains e-mail address, which was sufficient for many applications (e.g. WLAN access).

Obviously it is not really a good idea to use e-mail address as username. There are many fields in JForum which are not used in my application, so my intention is to use one of them as nick name which should be displayed instead of the username. Usage of LDAP attribute "displayName" would be also a sufficient solution. If displayName exists, it should be shown, otherwise uid (username) should be displayed. Is there an easy way to implement that while update path will not be broken ?

On the other hand patching of source code will yield into problems, if a new version of JForum should be installed.

Now I added aliases, so it is possible to find an entry with multiple different distinguished names.



now with search option -a search:



This LDAP server requires a login with a valid account for searching.

Conclusion: If JForum would be able to connect with a configurable account it can search for a specific entry like ldapsearch does. Now it read the returned dn and authenticates with that dn. What is your opinion regarding that way to solve that nasty "Display Name / Username" issue ?

[originally posted on jforum.net by taunusstein.net]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Hi,

Bringing this topic back up again

I've been asked to make sure that when you login with your username, it's not your username that has to be displayed, but your first and last name.

As Monroe stated this can be done by using user.from.

I have tried this in the user_profile.htm template as follows:



I have changed this to:



But when I access the profile page of a user, I get this error message:


[originally posted on jforum.net by jeetn]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
I have u.from to u.name.

What I get now is for example: Profile for null null


Where can you set these values like u.name? Maybe something is wrong there?
[originally posted on jforum.net by jeetn]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Can someone tell me why firstName and lastName are not being saved in the database?

If I use u.name in the templates I get null null as result. This has to be because he can't find a value for them...


I have been debugging and these are the steps I followed.

I logged in with a user. I set that user firstName and lastName. I update the user. I'm logged in.

I log out again. I login again with the same user. I go to my debug screen. I get the user using userDao, I go look for the firstName and lastName. I see both of them are null.


Why aren't these saved??
[originally posted on jforum.net by jeetn]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
I have found my answer.

I had to do the following:

- Change my mysql_dbstruct so 2 extra columns in the jforum_users table were added (firstname and lastname)
- Change my generic_queries.sql. Add 2 parameters to the update statement
- Change the update method and the fillUserFromResultSet method in the GenericUserDao. Adding 2 parameters.

That's about it. Also change your template username to name ;)
[originally posted on jforum.net by jeetn]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Now I have managed to do that, I still need to change this in all templates :s

Somebody wouldn't happen to know which all have to be changed?


I searched every template in the default folder for username. I changed that to name unless it was from i18n...


Already experiencing some trouble Any help here could be very handy It well be a very long search else
[originally posted on jforum.net by jeetn]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Nobody who can help??

What templates need to be changed? How do they have to be changed? With the last question I mean you have several different ways the username is being used in the different templates. Do you need to change this to name everywhere??
[originally posted on jforum.net by jeetn]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Finally got the link of andowson to work... Didn't want to open here...

I just followed everything he said. When I want to visit "Test Forum" (forum standard created when you install JForum) I get this error:



The last few lines out of the stacktrace are:



When you go looking at the line of GenericModerationDao you'll see the cause is this query:



You can see there is one parameter in this query. So why the error? I have no idea :s

Maybe you guys have any ideas?

Here's the full stacktrace:


[originally posted on jforum.net by jeetn]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Got some other riddles to be solved ^^


I'm logged in as admin. I can't watch Test Forum.

I log in as another user. I can watch Test Forum.


Where's the logic in that? First I get an error about parameters and with another user everything works fine ^^


I delete Test Forum. I create another forum. I can watch this forum with both users. I create another forum. I make some topics in one forum. I can watch everything with both.

I then want to moderate the forums. I have to change my rights so I can moderate the newly created forums. I go to forum index. Click the forum I want to moderate.

Well, what do you know. I get the parameter error again ^^


How the hell do you solve something like that??
[originally posted on jforum.net by jeetn]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Install an unmodified version of jforum in a different webapp (e.g. using /jforumOrig URI ) with a different DB catalog and db user. Check if the problem exists there. If so, report here.

Otherwise, the problem is in the modification...
[originally posted on jforum.net by monroe]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
I did what you asked.

Downloaded JForum source, made the modification according to the adowsons site.

Don't have those errors anymore.


What I do have are still some fields that are displayed as null null.

When you look at a post. Author is null null.
Member listing. Username is also null null.
When sending private message. And use the 'Find user'. Search still is needed on username. The name is shown as first and last name. But it's also null null.

I'll take a backup of this setup. And start modifying some stuff
[originally posted on jforum.net by jeetn]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
I have solved all my issues

Everywhere is the first and last name of the user being shown
[originally posted on jforum.net by jeetn]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Display name
 
Similar Threads
Function call doubt
Need help on Passing parameters
Passed SCJP
Any good Design Patterns for extending Value Objects?
Pass a parameter to an event handler