News:

Dear forum visitors, if the support forum is not available, please try again a few minutes later. Thanks!

Main Menu
Support-Forum

How to remove links from myhistory page?

Started by tillhunter, 16.06.2018 13:40:22

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

tillhunter

Hi.

I've tried to make changes at My Download History but can't do that.



I want to remove a link that shows after file title and make a download title linkable that will redirect user to this file page.
I have tried to change {log_file_title} to {file_title} but this tag not rendering here in this file.



Here are the questions:
1. How can I remove link from download name?
2. How to add link back to download page?

Best regards
  •  

Arno

#1
Hi,
Quote1. How can I remove link from download name?
When I use this menu type I get not listed any link. Can it be that you have already modify it.

The original line 128 should be:$html_file = str_replace('{log_file_title}', '<b>'.$files[$i]->log_title.'</b> ('.basename($files[$i]->log_file_name).')', $html_file);
Quote2. How to add link back to download page?
See example pic for a simple link.
Added in line 136:    $document = JFactory::getDocument();
    $db       = JFactory::getDBO();
    $user     = JFactory::getUser();
    $access_levels   = implode(',', $user->getAuthorisedViewLevels());
    $active_language = $document->language;
   
    $sql = 'SELECT id FROM #__menu WHERE (link LIKE ' . $db->Quote('index.php?option=com_jdownloads&Itemid='). ' OR link LIKE ' . $db->Quote('index.php?option=com_jdownloads&view=categories'). '  ) AND published = 1 AND client_id = 0 AND access IN ('.$access_levels.')' ;
    $db->setQuery($sql);
    $result = $db->loadResult();
    $html .= '<div><a href="'.JRoute::_('index.php?option=com_jdownloads&view=categories&Itemid='.(int)$result).'">Back to Download Area</a></div>';


You could also copy only the link given from the frontend. Then you need only the last line like: $html .= '<div><a href="link_from_frontend">Back to Download Area</a></div>';

[gelöscht durch Administrator]
Best Regards / Gruß
Arno
Please make a Donation for jDownloads and/or write a review on the Joomla! Extensions directory!
  •  

tillhunter

Hi.
Thanks for your reply.
But it didn't solve the problem.

1. I didn't make any changes in files I just started. The code is exactly same in that file.
Quote$html_file = str_replace('{log_file_title}', ''.$files[$i]->log_title.' ('.basename($files[$i]->log_file_name).')', $html_file);
I noticed that by default user can see file name. As I'm using external links to my download instead of file name it is showing link. Need to remove that link and display only title. How can I do that?

2. This code appearing at the end of download list (I add it to line 135 in myhistory/default.php) and returning me back to the category. How to make it return every download to its page?
Quote$document = JFactory::getDocument();
    $db       = JFactory::getDBO();
    $user     = JFactory::getUser();
    $access_levels   = implode(',', $user->getAuthorisedViewLevels());
    $active_language = $document->language;
   
    $sql = 'SELECT id FROM #__menu WHERE (link LIKE ' . $db->Quote('index.php?option=com_jdownloads&Itemid='). ' OR link LIKE ' . $db->Quote('index.php?option=com_jdownloads&view=categories'). '  ) AND published = 1 AND client_id = 0 AND access IN ('.$access_levels.')' ;
    $db->setQuery($sql);
    $result = $db->loadResult();
    $html .= '<div><a href="'.JRoute::_('index.php?option=com_jdownloads&view=categories&Itemid='.(int)$result).'">Back to Download Area</a></div>';


I have tried to add this code after file details and it is not appearing on the frontend


Also what should add instead of link_from_frontend in this code?
Quote$html .= '<div><a href="link_from_frontend">Back to Download Area</a></div>';

Sorry if I ask stupid questions.
I'm the newbie.

Thank you for your help
Best regards
  •  

ColinM

Hi
Further to Arno's suggestions if you just want to remove the file name as indicated in pic history01.png

then go to Line 128 or thereabouts where you should find
     $html_file = str_replace('{log_file_title}', '<b>'.$files[$i]->log_title.'</b> ('.basename($files[$i]->log_file_name).')', $html_file);

Modify so that the code looks like below
   
//        $html_file = str_replace('{log_file_title}', '<b>'.$files[$i]->log_title.'</b> ('.basename($files[$i]->log_file_name).')', $html_file);
      $html_file = str_replace('{log_file_title}', '<b>'.$files[$i]->log_title.'</b>', $html_file);

     
This gives the result as shown in  pic history02.png
If you now want to insert a  link to the actual Download then this is much more complex. And will include database searches as Arno indicates
I am not sure exactly what you want from such a link.  It may help if you could clarify the end result.  Is it to show the download again in say a Download Details View, is it to just make it a link that could download like from the Content plugin; is it to show which category the Download is in, or what?
Colin


[gelöscht durch Administrator]
Colin M
  •