Get currently logged in user's name.
Hello all,
I've got a subsonic 4.7b3 install that I'm working on making some modifications on. I am trying to modify the dashboard page (my version of the 'home.jsp') to greet the user with their username when they visit the page. I'm tempted to upgrade the install, but I doubt it would make a difference here, and I'm not going to do it just for this to work.
${model.user.username} returns null. Is there something missing here, or is there another way to get this data? I see that's where the logout button normally gets the username.
I also tried something like
to try to steal the username from the logout message... That also returns null, so I suspect that it's not my code that's the problem. It appears the ${model.user.username} key can't be called from the main window? I'm not super comfortable with Java, but this seemed like it should be straightforward.
Anyone run into this before?
Thanks!!
**EDIT**
It works on the left pane also, so it has to be something that's different in the main window.
I've got a subsonic 4.7b3 install that I'm working on making some modifications on. I am trying to modify the dashboard page (my version of the 'home.jsp') to greet the user with their username when they visit the page. I'm tempted to upgrade the install, but I doubt it would make a difference here, and I'm not going to do it just for this to work.
${model.user.username} returns null. Is there something missing here, or is there another way to get this data? I see that's where the logout button normally gets the username.
I also tried something like
- Code: Select all
<h1>Hi, <script type="text/javascript">
var nameCurrentUser = "";
var StealUser = "<fmt:message key='top.logout'><fmt:param value='${model.user.username}'/></fmt:message>";
var foundUser = StealUser.replace("Log out ", nameCurrentUser);
document.write("<font>" + foundUser);
document.write("</font>");
</script>
</h1>
to try to steal the username from the logout message... That also returns null, so I suspect that it's not my code that's the problem. It appears the ${model.user.username} key can't be called from the main window? I'm not super comfortable with Java, but this seemed like it should be straightforward.
Anyone run into this before?
Thanks!!
**EDIT**
It works on the left pane also, so it has to be something that's different in the main window.