XFileSharing Pro - How to display a message for anonymous with upload disabled?

Message
Author
OooLong
Posts: 18
Joined: Feb 10, 2010 2:33 am

How to display a message for anonymous with upload disabled?

#1 Postby OooLong » Sep 20, 2012 3:07 am

Hi everyone,

I tried to alter the code so I can display a custom message for anonymous user with disabled upload turn on, by basically saying something like "You need to register to able to upload" by altering the upload_form.html with codes like these:

<TMPL_UNLESS premium>
<div style="font-size: 13px;">To start upload. You must be a registered user. Please <a href="mysite.com/?op=registration">register on the site.</a></div>
</TMPL_UNLESS>

I also try

<TMPL_IF anon>
<div style="font-size: 13px;">To start upload. You must be a registered user. Please <a href="mysite.com/?op=registration">register on the site.</a></div>
</TMPL_IF>

and

<TMPL_IF anonymous>
<div style="font-size: 13px;">To start upload. You must be a registered user. Please <a href="mysite.com/?op=registration">register on the site.</a></div>
</TMPL_IF>

None of these appear to be working. Does anyone have a working solution for this? If you have, any help would be greatly appreciated. Thank you.

trinsic
Posts: 149
Joined: Dec 21, 2009 9:24 am

#2 Postby trinsic » Sep 20, 2012 4:20 am

Like in XFS 1.8? I've found in 2.0 if anonymous upload is disabled then it redirects to the login page. If you just want to display an error message instead then do this, in index.cgi put a number sign (#) at the start of lines 431, 432 and 433 like so:

Code: Select all

   #$ses->redirect("?op=login") if !$c->{enabled_anon} && !$ses->getUser;
   #$ses->redirect("?op=login") if !$c->{upload_on} && $utype eq 'anon';   
   #$ses->message("Uploads are disabled for your user type","Upload error") if !$c->{upload_on};
Underneath put:

Code: Select all

   $ses->message("To start upload. You must be a registered user. Please <a href=\"$c->{site_url}/?op=registration\">register on the site.</a>") if !$c->{upload_on_anon} && $utype eq 'anon';

http://pastebin.com/raw.php?i=QbB7DWb7

OooLong
Posts: 18
Joined: Feb 10, 2010 2:33 am

#3 Postby OooLong » Sep 20, 2012 5:20 pm

trin thank you. I will try this out and update the status here. I currently use 1.9 not 1.8. Thx alot.