Access UserLogin value from within custom TicketModule

Moderator: crythias

Locked
brandner
Znuny newbie
Posts: 10
Joined: 13 Oct 2015, 20:14
Znuny Version: 5.0.9
Real Name: Tony Brandner

Access UserLogin value from within custom TicketModule

Post by brandner »

I have a custom ticket module, and I am able to get the selected ticket ID using

Code: Select all

[% Data.TicketID | html %]
Does anyone know if it's possible to get other variables, such as the current UserLogin?
At first glance it seems that it is not possible, perhaps I would have to change Modules/AgentTicketZoom to add it, but not sure how.
brandner
Znuny newbie
Posts: 10
Joined: 13 Oct 2015, 20:14
Znuny Version: 5.0.9
Real Name: Tony Brandner

Re: Access UserLogin value from within custom TicketModule

Post by brandner »

Still struggling here. I thought that this might work, but I guess it isn't defined when I need it.

Code: Select all

[% Data.UserLogin %]
How can I get the UserLogin (username) value into my Ticket Menu Module link?
brandner
Znuny newbie
Posts: 10
Joined: 13 Oct 2015, 20:14
Znuny Version: 5.0.9
Real Name: Tony Brandner

Re: Access UserLogin value from within custom TicketModule

Post by brandner »

Flipping it around, one option is to get it via JS on the front end:

Code: Select all

console.log(Core.Config.Get('UserID'));
I'm not sure how reliable this is, but it is interesting to see the big JS packet of config data made available to the front end by OTRS.

I would much rather pass it in through my server-side code at Kernel/Output/HTML/TIcketMenu/mycode.pm
RStraub
Znuny guru
Posts: 2210
Joined: 13 Mar 2014, 09:16
Znuny Version: 6.0.14
Real Name: Rolf Straub

Re: Access UserLogin value from within custom TicketModule

Post by RStraub »

The .tt file can only access what the .pm files "gives" them. For UserID or Login however, there are enviroment variables. Try:

[% Env("UserID") %] or [% Env("UserLogin") %]
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
Locked