| View previous topic :: View next topic |
| Author |
Message |
applewar
Joined: 08 Feb 2011 Posts: 71
|
Posted: Jun 25, 2011 4:02 pm Post subject: [RESOLVED] Get the uid to insert it into a script |
|
|
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 |
|
| Back to top |
|
 |
nyan
Joined: 28 Oct 2010 Posts: 121
|
Posted: Jun 26, 2011 4:08 pm Post subject: |
|
|
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}, |
|
| Back to top |
|
 |
applewar
Joined: 08 Feb 2011 Posts: 71
|
Posted: Jun 26, 2011 10:55 pm Post subject: |
|
|
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) |
|
| Back to top |
|
 |
admin Site Admin

Joined: 22 Mar 2006 Posts: 1283
|
Posted: Jun 27, 2011 7:41 am Post subject: |
|
|
| You need to check if it's defined first. |
|
| Back to top |
|
 |
applewar
Joined: 08 Feb 2011 Posts: 71
|
Posted: Jun 27, 2011 3:58 pm Post subject: |
|
|
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  |
|
| Back to top |
|
 |
|