XFileSharing Pro - [RESOLVED] Get the uid to insert it into a script

Message
Author
applewar
Posts: 67
Joined: Feb 08, 2011 4:21 am

[RESOLVED] Get the uid to insert it into a script

#1 Postby applewar » Jun 25, 2011 4:02 pm

Hello,

I have a small problem with the current configuration of Xfilesharing Pro.

I wish I could get the uid of the user from their username in order to then insert it into a script for a survey, but I can not do it properly, or even not at all.

I managed to create a page that retrieves by adding the name of the user in the ajoutenant in the url and using the header in php, but I wish I could do otherwise.

I have thought about changing the file index.cgi but I do not know Perl and do not venture to touch it.

Could someone give me a working solution please?

Sincerely
Last edited by applewar on Jun 27, 2011 3:59 pm, edited 1 time in total.

nyan
Posts: 163
Joined: Oct 28, 2010 8:01 pm

#2 Postby nyan » Jun 26, 2011 4:08 pm

Try TMPL_VAR usr_id
if it's not defined, define it yourself at the print template parts of the script (download0/1/2)
'usr_id' = $ses->getUser->{usr_id},

applewar
Posts: 67
Joined: Feb 08, 2011 4:21 am

#3 Postby applewar » Jun 26, 2011 10:55 pm

Thanks nyan, I've define it manually, it's works with:

'usr_id' => $ses->getUser->{usr_id},

but I've got an error when a non-registered member try to download, because he hasn't got usr_id.

Error is:

Can't use an undefined value as a HASH reference at index_dl.pm on line 376

Any solution for that ? (Yes, I'm a newbies in Perl)

admin
Site Admin
Posts: 1839
Joined: Mar 22, 2006 12:32 pm

#4 Postby admin » Jun 27, 2011 7:41 am

You need to check if it's defined first.

applewar
Posts: 67
Joined: Feb 08, 2011 4:21 am

#5 Postby applewar » Jun 27, 2011 3:58 pm

I've modified the line, it's work great with:

'usr_id' => $ses->getUserId,

When user is registered, display usr_id and when is non registered, display nothing.

And for my banner, I apply filter for non-registered with TMPL_IF my_login.

Thanks for your help nyan and admin ;)