Author Topic: Bug and fix with user locked out[Solved in]  (Read 369 times)

0 Members and 1 Guest are viewing this topic.

Offline WernerF

  • Newbie
  • *
  • Posts: 5
one of my users has locked himself out after he had deleted a download file on the jD front end edit dialog and then left the dialog.
The download was then displaied without a link and download button because there is no longer a file attached. Ok so far.
Unfortunately there is also no longer an edit button next to the download title so he could not attach a new file once he had left the dialog.
This is a bug because the edit dialog icon is only shown if there is also an url to a file. But the icon should always be shown even if there is no file attachment.

Please fix the file com_jdownloads/views/category/tmpl/default.php. On line 1469+ or so you should find the following 2 lines:
                    // user may not use download link
                    $html_file = str_replace('{file_title}', $files[$i]->title, $html_file);
Change the secon linbe to
                    $html_file = str_replace('{file_title}', $files[$i]->title.' '.$editIcon, $html_file);
and you're done.

This was a complex 'challenge' involving several files. So requires a new release to fully fix done in  Colin
« Last Edit: 17.10.2021 14:46:58 by ColinM »

Offline ColinM

  • Moderator
  • *
  • Posts: 4.157
Re: Bug and fix with user locked out
« Reply #1 on: 10.09.2021 13:49:06 »
You are right that is a bug.  After a quick look at the code, but possibly your solution may not be the correct one for all situations. 

The modification you suggest is in the Else part of an if statement:
Code: [Select]
if ($user_can_see_download_url && !$has_no_file){...} else {change made here}
So whilst the change will show the edit symbol as desired there is no check that the user is permitted to see the Download!
I suspect that removing the
Code: [Select]
&& !$has_no_file from the if statement may be the solution but I have not yet checked that.

The edit icon only fails to appear in certain combinations of the relevant parameters in the Front End Options:  Activate direct-downloading, View Download detail page, Use Downloads title as download link and Use Link in Symbols.  There are 16 cases and it only appears to fail in four of them.

As well as the Category view I think this will also be a challenge in Downloads, Download and MyDownload views.I will update when I have checked out better

« Last Edit: 10.09.2021 13:57:25 by ColinM »