Search the FirstSpirit Knowledge Base
I tried this: #global.project.getUserService().getUser().getLoginName() but this returns "SYSTEM".
Why? What I would like to have is the current user.
I want to retrieve currently logged in user name
Hi Michael
My requirement is when user logged into first-spirit & goto Content Creator then logged in user name should be display on HTML O/P channel.
For that we've already done the HTML coding to show the list of articles. Along with we need to show the logged in user name as well.
Hi Tanmay,
I‘m still not sure WHY you need the user name in the page itself - but as I understand it is not necessarily about GENERATING the user into the HTML source (which is not possible) but only about DISPLAYING it, correct? The latter can be achieved using JS together with an executable (Marcel‘s approach).
But before getting into details I just want to be sure that fits your use case.
Regards
Michael
Hi OK thank you for this. But is this possible to select name who has modified the article.
hi,
yes.
User user = dataset.getEditor();
Hi How to write this in HTML section.
Hi,
you have to write i like
$CMS_VALUE(datasetVariable.getEditor().getLoginName())$
Hi,
ah, ok. You don't want the currently logged in user in the HTML but the one who made the last change? In this case, I usually don't recommend to use the value stored at the object (as Marcel suggests).
Reason(s): From time to time it may be necessary to automatically update/change objects, for example due to a data migration or due to an automated post processing before generation - in that case the (technically) last editor would be a system user... Also: The user may be deleted in the future...
It is generally possible to "copy" the user's login to a normal text input (only when using a client) - which is usually the way I suggest. But this will need some (minor) module implementation.
But of course, that depends on the use case which we still don't know 😉
Regards
Michael