__CurrentUser__

I think I might have found something weird going on. One of the
included searches uses the special string “CurrentUser” as a
search term. This is mapped in the Elements/ShowSearch file to be
$session{“CurrentUser”}->Id.

Now the search works properly on the front page, but if you go into
the query (edit -> edit predefined search) and choose “Show Results”,
I get no results back. Is it possible that this variable is not being
replaced in some locations?

What’s even weirder is that I enabled mysql query logging, and I saw
the value “CurrentUser” being passed to the database from
different places, including the front page where the query seems to
work.

All this is getting back to creating a “My Requests” search that works
for all users. I have a query that works if I put my username in, but
I can’t get a query for the current logged in user working.

Steve

What is going on is that some searches used on the front page have that
special variable in them and the components that display the search results
substitute CurrentUser before passing the search to the search engine.
It would be better if search parser handled this at a lower level, but it
doesn’t.On 1/7/08, Steve Cochran stephen.cochran@kingarthurflour.com wrote:

I think I might have found something weird going on. One of the
included searches uses the special string “CurrentUser” as a
search term. This is mapped in the Elements/ShowSearch file to be
$session{“CurrentUser”}->Id.

Now the search works properly on the front page, but if you go into
the query (edit → edit predefined search) and choose “Show Results”,
I get no results back. Is it possible that this variable is not being
replaced in some locations?

What’s even weirder is that I enabled mysql query logging, and I saw
the value “CurrentUser” being passed to the database from
different places, including the front page where the query seems to
work.

All this is getting back to creating a “My Requests” search that works
for all users. I have a query that works if I put my username in, but
I can’t get a query for the current logged in user working.

Steve


The rt-users Archives

SAVE THOUSANDS OF DOLLARS ON RT SUPPORT:

If you sign up for a new RT support contract before December 31, we’ll
take
up to 20 percent off the price. This sale won’t last long, so get in touch
today.
Email us at sales@bestpractical.com or call us at +1 617 812 0745.

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Good info, thanks.

So that means to have a “My Requests” widget on the “RT At A Glance”
page, I’ll have to find where the hack to turn CurrentUser into
the username happens, and make it happen for my widget as well.

Seems like what I want to do should be really easy. Display a widget
that shows what the self service interface would show.

SteveOn Jan 7, 2008, at 9:59 PM, Todd Chapman wrote:

What is going on is that some searches used on the front page have
that special variable in them and the components that display the
search results substitute CurrentUser before passing the search
to the search engine. It would be better if search parser handled
this at a lower level, but it doesn’t.

Good info, thanks.

So that means to have a “My Requests” widget on the “RT At A Glance”
page, I’ll have to find where the hack to turn CurrentUser into
the username happens, and make it happen for my widget as well.

Seems like what I want to do should be really easy. Display a widget
that shows what the self service interface would show.

SteveOn Jan 7, 2008, at 9:59 PM, Todd Chapman wrote:

What is going on is that some searches used on the front page have
that special variable in them and the components that display the
search results substitute CurrentUser before passing the search
to the search engine. It would be better if search parser handled
this at a lower level, but it doesn’t.

In case anyone else needs to do this and for the sake of the archives,
here’s how I got it working:

I created html/Callbacks/KAF/Elements/ShowSearch/ModifySearch as
follows:

Replace any instances of CurrentUserEmail with

$session{‘CurrentUser’}->EmailAddress
$Search->{‘Query’} =~ s/CurrentUserEmail/$session{‘CurrentUser’}-

EmailAddress/ge;
</%init>
<%args>
$Search => undef
</%args>

Then creating a saved search called “My Requests” as follows:

Requestor.EmailAddress = ‘CurrentUserEmail’ AND ( Status = ‘new’
OR Status = ‘open’ )

Subject/
TITLE:Subject’, ‘Status’, ‘QueueName

Adding “My Requests” to the Summary area works well enough for now.
Might fiddle with the subject or display results at some point to make
sure it stays short and sweet.

Thanks for everyone’s help,
SteveOn Jan 7, 2008, at 11:10 PM, Steve Cochran wrote:

Good info, thanks.

So that means to have a “My Requests” widget on the “RT At A Glance”
page, I’ll have to find where the hack to turn CurrentUser into
the username happens, and make it happen for my widget as well.

Seems like what I want to do should be really easy. Display a widget
that shows what the self service interface would show.

Steve

On Jan 7, 2008, at 9:59 PM, Todd Chapman wrote:

What is going on is that some searches used on the front page have
that special variable in them and the components that display the
search results substitute CurrentUser before passing the search
to the search engine. It would be better if search parser handled
this at a lower level, but it doesn’t.


The rt-users Archives

SAVE THOUSANDS OF DOLLARS ON RT SUPPORT:

If you sign up for a new RT support contract before December 31,
we’ll take
up to 20 percent off the price. This sale won’t last long, so get in
touch today. Email us at sales@bestpractical.com or call us at +1
617 812 0745.

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly
Media.Buy a copy at http://rtbook.bestpractical.com