How to easily get and display user alias?


#1

Hi! I’d like to display the user alias instead of the user login in the Hello portion on the Piwik Dashboard.

It currently displays the user login.

I’m using the user alias as the user’s name, since the user login needs to be unique and of course secret. And so want to display this instead.

Is there an easy pre-created way to access the user alias? Is it stored in a current user object somewhere?

In a perfect world I’d like to change the variable below in top_bar.tpl from:

{‘General_HelloUser’|translate:"$userLogin"}

to:

{‘General_HelloUser’|translate:"$userAlias"}

And before I go writing a change, thought I’d quick ask if there is an easy way to grab the alias from an existing in memory object. Or if the user alias is stored in a global object already somewhere.

Thanks!

-C


#2

bump…

So no easy precreated Piwik variable like userLogin is, for user alias? Not something like userAlias? Don’t want to reinvent the wheel, if there already is a data variable in Piwik for the user alias available in a Piwik class somewhere.

-C


(Matthieu Aubry) #3

I don’t think there is currently as we don’t display it. I wonder if we should display the Alias always, if it is set to something?


#4

Sup Matt! How are ya? I think that could be a good idea, The user table in Piwik uses the login as unique since it doesn’t have an auto-incremented unique numerical user id column for it.

We are trying out your system to be used for and in our software that others will use with ours, we have multi-users and multi-sites so we precreate/autocreate the user login using login.domainname to be able to keep them all unique and sorted in the Piwik system. In our system that also allows us to easily get the login and the domain from the Piwik login.

Unfortunately, two things happen rather quick, the Piwik login being displayed is then login.domainname which isn’t bad, but the display length can get rather long, thus breaking the Piwik Dashboard.

And two in the current Dashboard you are displaying the login which is probably not as secure as it could be.

Displaying the UserAlias, fixes both these things because no login information is displayed and the userAlias doesn’t have to be unique because it’s not a key. So John’s welcome will say Hello John! =) And Apollo14’s login will say hello Apollo14 if the alias is a nickname or really anything they want it to say since it’s an alias. It’s kind of standard practice in the software world.

Any ways, give it some thought.

Thanks for the great software! And for answering my question, I know you guys are probably busy, we came from open source as well so I know how it can be.

Thanks again,

-C